33800 Docs

← Retour
FROM nginx:alpine WORKDIR /usr/share/nginx/html # Supprimer le contenu par défaut RUN rm -rf ./* # Copier les fichiers statiques COPY . . # Configuration nginx personnalisée RUN cat > /etc/nginx/conf.d/default.conf <<'EOF' server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # Gzip gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml; # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } # SPA fallback location / { try_files $uri $uri/ /index.html; } # Health endpoint location /health { access_log off; return 200 '{"status":"healthy"}'; add_header Content-Type application/json; } } EOF EXPOSE 80 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost/health || exit 1