# Front Data Sentinel — build Vite (pnpm) puis service statique via nginx. FROM node:22-alpine AS build WORKDIR /app COPY package.json pnpm-lock.yaml ./ RUN corepack enable && pnpm install --frozen-lockfile COPY . . # Tests (vitest) exécutés pendant le build : un test rouge casse le build. RUN pnpm test # URL de l'API injectée au build (Vite inline les import.meta.env.VITE_*). ARG VITE_API_URL ENV VITE_API_URL=$VITE_API_URL RUN pnpm build # SHA du commit construit, servi sur /version.json : permet de vérifier quelle # version est réellement déployée sans se fier au cache du navigateur. ARG APP_BUILD=local RUN printf '{"build":"%s"}' "$APP_BUILD" > /app/dist/version.json FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80