From bc5370d84d5c2d44f0a9de7ad3de10e93f8c15c6 Mon Sep 17 00:00:00 2001 From: "laurent.deleers@gmail.com" Date: Sat, 7 Feb 2026 18:21:08 +0100 Subject: [PATCH] autocomit --- frontend/Dockerfile | 29 +++++++++++++++++++++++++++++ frontend/nginx.conf | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 frontend/Dockerfile create mode 100644 frontend/nginx.conf diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..3d8b8a4 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,29 @@ +# Multi-stage build for Angular frontend +FROM node:18-alpine AS build + +WORKDIR /app + +# Copy package files and install dependencies +COPY package*.json ./ + +RUN npm install +RUN npm ci + +# Copy source code and build +COPY . . +RUN npm run build + +# Production stage with nginx +FROM nginx:alpine + +# Copy built app to nginx html directory +COPY --from=build /app/dist/ldpv2-frontend/browser /usr/share/nginx/html + +# Copy nginx configuration +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Expose port +EXPOSE 80 + +# Start nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..f3b4d94 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,39 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Gzip compression + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + # Angular routes - fallback to index.html for SPA + location / { + try_files $uri $uri/ /index.html; + } + + # Proxy API requests to backend + location /api/ { + proxy_pass http://backend:8080/api/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Cache static assets + location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + + # Security headers + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-XSS-Protection "1; mode=block" always; +}