FROM node:22-alpine AS build WORKDIR /app COPY package.json package-lock.json ./ # npm ci fails here: lockfiles written on macOS omit the @emnapi/* deps of # optional wasm32-wasi packages (long-standing npm bug), so use install. RUN npm install --no-audit --no-fund COPY . . # Public URL baked into canonical/OG/JSON-LD tags; pass your domain at build # time (or set it in .env). An empty arg must not shadow the .env value, so # unset it when blank — process.env beats .env files in Vite. ARG VITE_SITE_URL= RUN if [ -z "$VITE_SITE_URL" ]; then unset VITE_SITE_URL; fi && npm run build FROM nginx:alpine COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]