From d7f5180eab08eefaa82377da156ff7e02da24541 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Mon, 18 May 2026 08:39:57 +0700 Subject: [PATCH] chore: add Dockerfile and dockerignore for production build Co-Authored-By: Claude Opus 4.7 --- .dockerignore | 7 +++++++ Dockerfile | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..01c16d9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +.git +.github +docs +logs +dist +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a24c425 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# Stage 1: Builder +FROM oven/bun:1.1-alpine AS builder + +WORKDIR /usr/src/app + +# Install dependencies (including devDependencies for build and lint) +COPY package.json tsconfig.json biome.json ./ +RUN bun install + +# Copy src and test directories +COPY src ./src +COPY test ./test + +# Run lint and build +RUN bun run lint +RUN bun run build + +# Stage 2: Runner +FROM oven/bun:1.1-slim AS runner + +WORKDIR /usr/src/app + +# Copy built files, schema, and package.json +COPY --from=builder /usr/src/app/dist/index.js ./dist/index.js +COPY schema.sql ./ +COPY package.json ./ + +# Expose port +EXPOSE 3000 + +# Start server +CMD ["bun", "dist/index.js"]