28 lines
869 B
Docker
28 lines
869 B
Docker
# --- Étape 1 : build de l'application Angular ---
|
|
FROM node:22-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Installation des dépendances (couche mise en cache tant que les manifestes
|
|
# ne changent pas). On utilise `npm ci` si un lockfile est présent, sinon
|
|
# `npm install` (utile tant que le lockfile n'a pas encore été généré/commité).
|
|
COPY package.json package-lock.json* ./
|
|
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
|
|
|
# Copie du code source et build de production.
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# --- Étape 2 : service par nginx ---
|
|
FROM nginx:1.27-alpine
|
|
|
|
# Configuration nginx (SPA + proxy /api -> backend:8080).
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copie du build Angular dans la racine servie par nginx.
|
|
COPY --from=build /app/dist/pdfeditor-frontend/browser /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|