Files
Talks/server/Dockerfile
Le Prévost-Corvellec Arnault 600c07e358
All checks were successful
Talks slides — image & chart / vars (push) Successful in 1s
Talks slides — image & chart / Helm chart (push) Successful in 15s
Talks slides — image & chart / Build container image (push) Successful in 47s
Update Dockerfile to use nginxinc/nginx-unprivileged image and enhance user permissions
- Switched base image to nginxinc/nginx-unprivileged for improved security.
- Adjusted user permissions and ownership settings for better compliance with non-root user practices.
- Removed unnecessary commands related to pid and user configuration in nginx.conf.
2026-04-08 21:51:44 +02:00

38 lines
1.2 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
# Image officielle « non-root » (nginxinc) : pid, user, port 8080 — on nimite pas nginx:alpine à coups de sed.
# https://github.com/nginxinc/docker-nginx-unprivileged
FROM nginxinc/nginx-unprivileged:stable-alpine
USER root
RUN --mount=type=cache,target=/var/cache/apk \
apk add --no-cache git
WORKDIR /usr/share/nginx/html
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}"
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY refresh.sh /refresh.sh
# Même UID que limage (nginx, 101) ; pas de retouche manuelle de nginx.conf.
RUN chmod +x /refresh.sh \
&& chown -R nginx:nginx /usr/share/nginx/html /refresh.sh \
&& mkdir -p /home/nginx \
&& chown nginx:nginx /home/nginx \
&& su nginx -s /bin/sh -c 'HOME=/home/nginx git config --global --add safe.directory /usr/share/nginx/html'
ENV HOME=/home/nginx
USER nginx
EXPOSE 8080
CMD sh -c "/refresh.sh & exec nginx -g 'daemon off;'"