Update Dockerfile and configuration files to use port 8080 and improve caching
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

This commit is contained in:
Le Prévost-Corvellec Arnault
2026-04-08 21:27:27 +02:00
parent 7b86ba15b2
commit e1576d2360
4 changed files with 29 additions and 4 deletions

View File

@@ -1,6 +1,9 @@
# syntax=docker/dockerfile:1
# BuildKit / buildx : cache apk + permissions posées au build (moins de travail / capabilities au runtime).
FROM nginx:alpine FROM nginx:alpine
RUN apk add --no-cache git RUN --mount=type=cache,target=/var/cache/apk \
apk add --no-cache git
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
@@ -19,6 +22,23 @@ RUN find . -mindepth 1 -delete \
COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY refresh.sh /refresh.sh COPY refresh.sh /refresh.sh
RUN chmod +x /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;'" CMD sh -c "/refresh.sh & exec nginx -g 'daemon off;'"

View File

@@ -1,5 +1,5 @@
server { server {
listen 80; listen 8080;
server_name localhost; server_name localhost;
# Racine web = contenu statique sparse (dossier content/ du dépôt). # Racine web = contenu statique sparse (dossier content/ du dépôt).
root /usr/share/nginx/html/content; root /usr/share/nginx/html/content;

View File

@@ -32,12 +32,13 @@ spec:
imagePullPolicy: {{ .Values.slides.image.pullPolicy }} imagePullPolicy: {{ .Values.slides.image.pullPolicy }}
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
# Port 8080 dans le conteneur : pas besoin de NET_BIND_SERVICE (ports privilégiés).
capabilities: capabilities:
drop: ["ALL"] drop: ["ALL"]
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: {{ .Values.slides.containerPort }}
protocol: TCP protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:

View File

@@ -14,8 +14,12 @@ slides:
replicaCount: 1 replicaCount: 1
# Port découte dans le conteneur (doit correspondre à server/nginx/default.conf, ex. 8080).
containerPort: 8080
service: service:
type: ClusterIP type: ClusterIP
# Port du Service (Ingress pointe ici) ; le trafic est envoyé vers containerPort sur les pods.
port: 80 port: 80
resources: resources: