Ajout des fichiers Dockerfile et nginx.conf pour la configuration du site avec Zola et Nginx
This commit is contained in:
parent
8154786e9b
commit
12adf2996b
3 changed files with 50 additions and 0 deletions
5
site/.dockerignore
Normal file
5
site/.dockerignore
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.git
|
||||
.gitignore
|
||||
public
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
26
site/Dockerfile
Normal file
26
site/Dockerfile
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# ---- Étape 1 : build du site avec Zola ----
|
||||
FROM ghcr.io/getzola/zola:v0.19.2 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# Construit le site statique dans /app/public
|
||||
# --base-url permet à Coolify de surcharger l'URL via la variable BASE_URL
|
||||
ARG BASE_URL=/
|
||||
RUN ["zola", "build", "--base-url", "/"]
|
||||
|
||||
# ---- Étape 2 : service du site avec nginx ----
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
# Config nginx (gestion des 404, cache des assets)
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copie le site généré
|
||||
COPY --from=builder /app/public /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
|
||||
CMD wget -q --spider http://localhost/ || exit 1
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
19
site/nginx.conf
Normal file
19
site/nginx.conf
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Page d'erreur générée par Zola
|
||||
error_page 404 /404.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# Cache long pour les assets statiques
|
||||
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg|woff2?)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue