ci
This commit is contained in:
2
server/.dockerignore
Normal file
2
server/.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
# Contexte minimal : seuls Dockerfile, nginx/ et refresh.sh sont nécessaires.
|
||||
# Le dépôt applicatif est cloné dans l'image (voir Dockerfile).
|
||||
22
server/Dockerfile
Normal file
22
server/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
||||
|
||||
# Image figée au clone ; le conteneur met à jour via refresh.sh (git pull origin main).
|
||||
# Seul le dossier content/ est extrait (sparse checkout) : léger et aligné sur la racine Nginx.
|
||||
ARG TALKS_REPO_URL=https://git.specificat.io/arnault/Talks.git
|
||||
ARG TALKS_BRANCH=main
|
||||
ARG TALKS_SPARSE_DIR=content
|
||||
|
||||
RUN git clone --filter=blob:none --sparse --branch "${TALKS_BRANCH}" --single-branch "${TALKS_REPO_URL}" . \
|
||||
&& git sparse-checkout init --cone \
|
||||
&& git sparse-checkout set "${TALKS_SPARSE_DIR}" \
|
||||
&& git config --global --add safe.directory /usr/share/nginx/html
|
||||
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY refresh.sh /refresh.sh
|
||||
RUN chmod +x /refresh.sh
|
||||
|
||||
CMD sh -c "/refresh.sh & exec nginx -g 'daemon off;'"
|
||||
12
server/nginx/default.conf
Normal file
12
server/nginx/default.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
# Racine web = contenu statique sparse (dossier content/ du dépôt).
|
||||
root /usr/share/nginx/html/content;
|
||||
index index.html index.htm;
|
||||
|
||||
location / {
|
||||
add_header Cache-Control "no-cache";
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
9
server/refresh.sh
Normal file
9
server/refresh.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Répertoire git : /usr/share/nginx/html (sparse checkout limité à content/).
|
||||
cd /usr/share/nginx/html || exit 1
|
||||
|
||||
while true; do
|
||||
echo "Pulling latest changes from origin/main (sparse content/)..."
|
||||
git pull origin main || echo "git pull failed, will retry in 300s"
|
||||
sleep 300
|
||||
done
|
||||
Reference in New Issue
Block a user