# Stage 1: Build React app FROM node:20-alpine AS build WORKDIR /app # Copy package files for apps/web # We use the local package files to avoid workspace hoisting issues in Docker COPY apps/web/package.json ./ # If there is a lockfile in apps/web, use it, otherwise use root (but root is workspace, so better not) # Let's try to generate a clean install RUN npm install --legacy-peer-deps # Copy source code COPY apps/web/ ./ # Build args ARG VITE_KLIPY_API_KEY ENV VITE_KLIPY_API_KEY=$VITE_KLIPY_API_KEY # Build web frontend RUN npm run build # Stage 2: Serve with Nginx FROM nginx:alpine # Copy built assets COPY --from=build /app/dist /usr/share/nginx/html # Custom Nginx config to proxy /api and /socket.io to server:3001 COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]