fix build file
This commit is contained in:
parent
0a7f1c6aa0
commit
50557bff92
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
# Stage 1: Build de l'application Angular
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copier les fichiers de dépendances
|
||||
COPY package*.json ./
|
||||
|
||||
# Installer les dépendances
|
||||
RUN npm ci
|
||||
|
||||
# Copier le reste des fichiers du projet
|
||||
COPY . .
|
||||
|
||||
# Builder l'application en mode production
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Servir l'application avec Nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copier les fichiers buildés depuis le stage précédent
|
||||
COPY --from=build /app/dist/dcb-bo-admin/browser /usr/share/nginx/html
|
||||
|
||||
# Copier la configuration Nginx personnalisée (optionnel)
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Exposer le port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Démarrer Nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
31
nginx.conf
Normal file
31
nginx.conf
Normal file
@ -0,0 +1,31 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Compression gzip
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript;
|
||||
|
||||
# Cache des assets statiques
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Redirection pour le routing Angular
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Sécurité - cacher la version Nginx
|
||||
server_tokens off;
|
||||
|
||||
# Headers de sécurité
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user