# Build Stage FROM node:20-alpine AS builder WORKDIR /app # Copy dependency manifests COPY package*.json ./ # Install all dependencies RUN npm install # 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 only production dependencies (Express, dotenv, @google/genai) RUN npm install --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"]