Skip to content

Commit

Permalink
Update Dockerfile.unprivileged
Browse files Browse the repository at this point in the history
  • Loading branch information
sim-tails authored Nov 21, 2024
1 parent c6f1f19 commit bea4974
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile.unprivileged
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
# to allow running NGINX S3 Gateway as a non root user.
# Steps are based on the official unprivileged container:
# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/Dockerfile-debian.template
FROM nginx-s3-gateway
FROM docker.io/nginxinc/nginx-s3-gateway:latest

# Implement changes required to run NGINX as an unprivileged user
RUN sed -i "/^server {/a \ listen 8080;" /etc/nginx/templates/default.conf.template \
&& sed -i '/user nginx;/d' /etc/nginx/nginx.conf \
&& sed -i 's#http://127.0.0.1:80#http://127.0.0.1:8080#g' /etc/nginx/include/s3gateway.js \
&& sed -i 's#80#8080#g' /etc/nginx/conf.d/default.conf \
&& sed -i 's#80#8080#g' /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh \
&& sed -i 's,/var/run/nginx.pid,/tmp/nginx.pid,' /etc/nginx/nginx.conf \
&& sed -i "/^http {/a \ proxy_temp_path /tmp/proxy_temp;\n client_body_temp_path /tmp/client_temp;\n fastcgi_temp_path /tmp/fastcgi_temp;\n uwsgi_temp_path /tmp/uwsgi_temp;\n scgi_temp_path /tmp/scgi_temp;\n" /etc/nginx/nginx.conf \
# Nginx user must own the cache and etc directory to write cache and tweak the nginx config
Expand Down

0 comments on commit bea4974

Please sign in to comment.