FROM node:22-alpine AS base # Install dependencies only when needed FROM base AS deps WORKDIR /app # Copy package files COPY package.json package-lock.json* ./ COPY apps/web/package.json ./apps/web/package.json # Install dependencies RUN npm ci # Rebuild the source code only when needed FROM base AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . # Build the project ARG NODE_ENV ARG VITE_API_URL ARG VITE_WS_URL RUN npx turbo run build --filter=web # Production image, copy the build files and run the server FROM nginx:1.27.1-alpine AS production COPY apps/web/nginx/default.conf /etc/nginx/conf.d/default.conf COPY --from=builder /app/apps/web/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx","-g","daemon off;"]