From 3fe361e554131b4f7953aa03eef47be73e70cf08 Mon Sep 17 00:00:00 2001 From: killer-cf Date: Mon, 5 Jan 2026 15:09:03 -0300 Subject: [PATCH] Refactor TypeScript configuration and improve type definitions; update main page layout with new styles and components for Secretaria de Esportes de Pernambuco. --- .dockerignore | 13 +++++++++++ Dockerfile | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..46d9d9a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +node_modules +.svelte-kit +.env +.env.* +!.env.example +!.env.test +.vscode +.git +.gitignore +.prettierignore +.prettierrc +.eslintignore +.eslintrc.js \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e8c8b19 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# Use the official Bun image +FROM oven/bun:1 AS base + +# Set the working directory inside the container +WORKDIR /usr/src/app + +# Create a non-root user for security +RUN addgroup --system --gid 1001 sveltekit +RUN adduser --system --uid 1001 sveltekit + +# Copy package.json and bun.lockb (if available) +COPY package.json bun.lockb* ./ + +# Install dependencies (including dev dependencies for build) +RUN bun install --frozen-lockfile + +# Copy the source code +COPY . . + +# Prepare SvelteKit and build the application +RUN bun run prepare +RUN bun run build +RUN bun run db:migrate + +# Production stage +FROM oven/bun:1-slim AS production + +# Set working directory +WORKDIR /usr/src/app + +# Create non-root user +RUN addgroup --system --gid 1001 sveltekit +RUN adduser --system --uid 1001 sveltekit + +# Copy built application from base stage +COPY --from=base --chown=sveltekit:sveltekit /usr/src/app/build ./build +COPY --from=base --chown=sveltekit:sveltekit /usr/src/app/package.json ./package.json +COPY --from=base --chown=sveltekit:sveltekit /usr/src/app/node_modules ./node_modules + +# Copy any additional files needed for runtime +COPY --from=base --chown=sveltekit:sveltekit /usr/src/app/static ./static + +# Switch to non-root user +USER sveltekit + +# Expose the port that the app runs on +EXPOSE 5173 + +# Set environment variables +ENV NODE_ENV=production +ARG ORIGIN=http://localhost:5173 +ENV ORIGIN=$ORIGIN +ENV PORT=5173 + +# Health check +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD bun --version || exit 1 + +# Start the application +CMD ["bun", "./build/index.js"]