# Stage 1: Build frontend FROM node:20-alpine AS frontend-builder WORKDIR /app/client COPY client/package*.json ./ RUN npm install COPY client/ ./ RUN npm run build # Stage 2: Production FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm install --production COPY src/ ./src/ COPY --from=frontend-builder /app/client/dist ./client/dist EXPOSE 3000 CMD ["node", "server.js"]