container-integration #1
18
VContainers/VApp/Containerfile
Normal file
18
VContainers/VApp/Containerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#FROM docker.io/nginx:stable-alpine
|
||||||
|
FROM docker.io/node:lts-alpine AS builder
|
||||||
|
## Bundle APP files
|
||||||
|
WORKDIR /app
|
||||||
|
COPY VApp ./
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM docker.io/nginx:stable-alpine
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
COPY ./VContainers/VApp/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# CMD ["npm","run","dev"]
|
||||||
|
#CMD ["sleep", "1000"]
|
||||||
24
VContainers/VApp/nginx.conf
Normal file
24
VContainers/VApp/nginx.conf
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
root /usr/share/nginx/html; # Chemin où les fichiers statiques sont copiés
|
||||||
|
|
||||||
|
index index.html index.htm; # Fichier par défaut à servir
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html; # Pour les applications SPA (Single Page Applications)
|
||||||
|
# cela redirige toutes les requêtes non trouvées vers index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache Control pour les fichiers statiques (optionnel mais bonne pratique)
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gzip compression (optionnel, améliore la performance)
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user