# ── Stage 1: build ────────────────────────────────────────────────────────── FROM node:22-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . # No VITE_FOOTBALL_API_KEY needed at build time — nginx handles auth RUN npm run build # ── Stage 2: serve ────────────────────────────────────────────────────────── FROM nginx:alpine # Copy built assets COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx template — the official nginx image runs envsubst on *.template # files at startup, producing /etc/nginx/conf.d/default.conf COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template # Custom entrypoint: generates .htpasswd from AUTH_USER/AUTH_PASSWORD, then # hands off to the official nginx entrypoint COPY docker-entrypoint.sh /docker-entrypoint-custom.sh RUN chmod +x /docker-entrypoint-custom.sh EXPOSE 80 ENTRYPOINT ["/docker-entrypoint-custom.sh"] CMD ["nginx", "-g", "daemon off;"]