# syntax=docker/dockerfile:1

########## Étape 1 : build Angular ##########
FROM node:24-alpine AS build
WORKDIR /src
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
RUN npx ng build --configuration production

########## Étape 2 : Nginx non root ##########
FROM nginxinc/nginx-unprivileged:1.30-alpine AS runtime
ENV API_UPSTREAM=http://api-web:8080 \
    FN_UPSTREAM=http://fn:3000
COPY docker/nginx/default.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /src/dist/front/browser /usr/share/nginx/html
EXPOSE 8080
