# ---------- 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 (mathew.aranroig.com); nginx # routes that to the backend # - the Nuxt server (SSR) reaches the backend through the same public # address — nginx at mathew.aranroig.com/api — never the container name ENV NUXT_PUBLIC_API_BASE= ENV NUXT_API_PROXY_TARGET=https://mathew.aranroig.com # 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"]