# Stage 1: build the React client FROM node:20-alpine AS client-build WORKDIR /app/client COPY client/package.json ./ RUN npm install COPY client/ ./ RUN npm run build # Stage 2: production server FROM node:20-alpine AS production WORKDIR /app/server COPY server/package.json ./ RUN npm install --omit=dev COPY server/ ./ # Copy built client assets COPY --from=client-build /app/client/dist /app/client/dist EXPOSE 3000 CMD ["node", "src/index.js"]