# Build Stage FROM node:20-alpine AS builder WORKDIR /app # Copy dependency manifests COPY package*.json ./ # Install exactly the dependency versions recorded in package-lock.json RUN npm ci # Copy full application codebase COPY . . # Compile frontend and bundle backend files RUN npm run build # Production alpine stage FROM node:20-alpine WORKDIR /app # Copy configuration files COPY package*.json ./ # Install exactly the locked production dependencies RUN npm ci --omit=dev # Copy compiled build resources from builder stage COPY --from=builder /app/dist ./dist # Expose port (Internal container routing to 3000) EXPOSE 3000 ENV NODE_ENV=production # Execute standalone node production entrypoint CMD ["node", "dist/server.cjs"]