rootless nginx

This commit is contained in:
Wolfgang Hottgenroth 2025-01-12 13:54:15 +01:00
parent c4e02c457c
commit 405548d58c

View File

@ -1,17 +1,19 @@
# builder
FROM hugomods/hugo:std-base-non-root AS builder
ARG BASE_URL ""
COPY content/ /src
RUN if [ "$BASE_URL" = ""]; then hugo; else hugo -b $BASE_URL; fi
# server
FROM nginx:alpine
COPY --from=builder /src/public /usr/share/nginx/html
EXPOSE 80
RUN \
chown -R nobody:nobody /var/cache/nginx /var/log/nginx && \
sed -i 's/listen\s\+80;/listen 8080;/' /etc/nginx/conf.d/default.conf && \
sed -i 's,pid\s\+/var/run/nginx.pid;,pid /tmp/nginx.pid;,' /etc/nginx/nginx.conf
USER nobody
EXPOSE 8080