- Add SKIP_ENV_VALIDATION to bypass Zod env check during next build - Bundle custom server.ts with esbuild so production uses Socket.io - Create worker entry point (src/worker.ts) with all BullMQ workers - Add esbuild build scripts for server and worker bundles - Fix Dockerfile.worker to include its own build stage - Fix pre-commit hook to work without global pnpm - Add CLAUDE.md with project conventions and quick reference Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
921 B
Docker
27 lines
921 B
Docker
# Stage 1: Install dependencies (dev deps needed for esbuild)
|
|
FROM node:20-alpine AS deps
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
WORKDIR /app
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile --prod=false
|
|
|
|
# Stage 2: Build the worker bundle
|
|
FROM node:20-alpine AS builder
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
ENV SKIP_ENV_VALIDATION=1
|
|
RUN pnpm build:worker
|
|
|
|
# Stage 3: Production runner (prod deps only)
|
|
FROM node:20-alpine AS runner
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
WORKDIR /app
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile --prod
|
|
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 worker
|
|
COPY --from=builder --chown=worker:nodejs /app/dist/worker.js ./worker.js
|
|
USER worker
|
|
CMD ["node", "worker.js"]
|