last
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# Dockerfile Frontend - Build Vite + Nginx
|
||||
# Stage 1: Build
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
@@ -7,14 +6,15 @@ WORKDIR /app
|
||||
# Copier les fichiers de dépendances
|
||||
COPY frontend/package*.json ./
|
||||
|
||||
# Installer les dépendances
|
||||
# Installation propre sans variables d'environnement parasitaires
|
||||
RUN npm ci
|
||||
|
||||
# Copier le code source
|
||||
COPY frontend/ ./
|
||||
|
||||
# Argument pour l'URL de l'API (défaut: docker network)
|
||||
ARG VITE_API_URL=http://backend:8008
|
||||
# Argument pour l'URL de l'API
|
||||
ARG VITE_API_URL
|
||||
ENV VITE_API_URL=${VITE_API_URL}
|
||||
|
||||
# Build de production
|
||||
RUN npm run build
|
||||
@@ -22,19 +22,17 @@ RUN npm run build
|
||||
# Stage 2: Nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copier la config Nginx personnalisée
|
||||
# Config Nginx
|
||||
COPY docker/frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copier les fichiers buildés
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Copier le script d'entrypoint pour injecter les variables d'environnement
|
||||
# Script d'entrypoint
|
||||
COPY docker/frontend/entrypoint.sh /docker-entrypoint.d/40-env-config.sh
|
||||
RUN chmod +x /docker-entrypoint.d/40-env-config.sh
|
||||
|
||||
# Exposer le port
|
||||
EXPOSE 80
|
||||
|
||||
# Healthcheck
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD wget -q --spider http://localhost/ || exit 1
|
||||
CMD wget -q --spider http://localhost/health || exit 1
|
||||
Reference in New Issue
Block a user