From 3f2282f680512498f0c96a0469bd8d31acd97d3a Mon Sep 17 00:00:00 2001 From: elpatron Date: Mon, 6 Oct 2025 17:30:31 +0200 Subject: [PATCH] docker: switch to runtime-only image using prebuilt dist/server-dist; no TS build in image --- Dockerfile | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index d37f149..519f1bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,3 @@ -# Multi-stage build for production -FROM node:22-alpine AS base - -# Install pnpm -RUN npm install -g pnpm - -# Set working directory -WORKDIR /app - -# Copy package files -COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ - -# Install dependencies -RUN pnpm install --frozen-lockfile - -# Copy source code -COPY . . - -# Build the application -RUN pnpm build - -# Production stage FROM node:22-alpine AS production # Install pnpm and required runtime tools @@ -34,17 +12,12 @@ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ # Install production dependencies only RUN pnpm install --frozen-lockfile --prod -# Copy built application from base stage -COPY --from=base /app/dist ./dist -COPY --from=base /app/server-dist ./server-dist -COPY --from=base /app/public ./public +# Copy prebuilt application artifacts from repository (no TS build in image) +COPY dist ./dist +COPY server-dist ./server-dist +COPY public ./public -# Copy necessary files for runtime -COPY --from=base /app/src/server/index.ts ./src/server/index.ts -COPY --from=base /app/src/server/routes ./src/server/routes -COPY --from=base /app/src/server/rpc ./src/server/rpc -COPY --from=base /app/src/server/lib ./src/server/lib -COPY --from=base /app/tsconfig.server.json ./tsconfig.server.json +# Copy necessary runtime files COPY start.sh ./start.sh # Create non-root user for security