Files
Talks/server/Dockerfile
Le Prévost-Corvellec Arnault e1576d2360
All checks were successful
Talks slides — image & chart / vars (push) Successful in 1m1s
Talks slides — image & chart / Helm chart (push) Successful in 1m57s
Talks slides — image & chart / Build container image (push) Successful in 2m22s
Update Dockerfile and configuration files to use port 8080 and improve caching
2026-04-08 21:27:27 +02:00

45 lines
1.8 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# syntax=docker/dockerfile:1
# BuildKit / buildx : cache apk + permissions posées au build (moins de travail / capabilities au runtime).
FROM nginx:alpine
RUN --mount=type=cache,target=/var/cache/apk \
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.
# Limage nginx:alpine place déjà des fichiers ici — il faut vider le répertoire avant git clone vers « . ».
ARG TALKS_REPO_URL=https://git.specificat.io/arnault/Talks.git
ARG TALKS_BRANCH=main
ARG TALKS_SPARSE_DIR=content
RUN find . -mindepth 1 -delete \
&& 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
# Caches et logs : créés ici avec le même schéma que lentrypoint nginx (évite le chown au démarrage).
# Propriétaire nginx (cf. /etc/nginx/nginx.conf user) → lentrypoint ne refait pas chown si tout est déjà cohérent.
RUN chmod +x /refresh.sh \
&& mkdir -p \
/var/cache/nginx/client_temp \
/var/cache/nginx/proxy_temp \
/var/cache/nginx/fastcgi_temp \
/var/cache/nginx/uwsgi_temp \
/var/cache/nginx/scgi_temp \
/var/log/nginx \
&& chown -R nginx:nginx \
/var/cache/nginx \
/var/log/nginx \
/usr/share/nginx/html
# Port non privilégié (pas de CAP_NET_BIND_SERVICE) ; le Service K8s mappe souvent 80 → 8080.
EXPOSE 8080
CMD sh -c "/refresh.sh & exec nginx -g 'daemon off;'"