# Stage 1: build the Vite app FROM node:20-alpine AS build WORKDIR /app COPY package*.json ./ RUN npm install COPY . . # VITE_ env vars are baked into the bundle at build time ARG VITE_GNOMMOWEB_URL ENV VITE_GNOMMOWEB_URL=${VITE_GNOMMOWEB_URL} RUN npm run build # Stage 2: serve with nginx FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html COPY nginx/nginx.prod.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]