# ---------- Build Stage ---------- FROM node:22-alpine AS builder WORKDIR /app RUN apk add --no-cache python3 make g++ git # Copy package files COPY package*.json ./ # Install dependencies RUN npm install ARG CACHEBUST=1 COPY . . # Production API wiring (baked into the build): # - the browser calls /api on its own origin; nginx forwards that to backend:5000 # - the Nuxt server (SSR) reaches the backend container by service name ENV NUXT_PUBLIC_API_BASE= ENV NUXT_API_PROXY_TARGET=http://backend:5000 # Build the Nuxt app RUN npm run build # ---------- Production Stage ---------- FROM node:22-alpine WORKDIR /app # Copy built output COPY --from=builder /app/.output ./.output # Expose Nuxt port EXPOSE 3000 # Start Nuxt production server CMD ["node", ".output/server/index.mjs"]