File tree Expand file tree Collapse file tree 4 files changed +12
-32
lines changed
Expand file tree Collapse file tree 4 files changed +12
-32
lines changed Original file line number Diff line number Diff line change 1- FROM nginx:1.25-alpine
1+ # nginx:unprivileged runs as non-root (UID 101) on port 8080 — no permission hacks needed
2+ FROM nginxinc/nginx-unprivileged:1.25-alpine
23
3- # Copy Swagger UI docs page
44COPY index.html /usr/share/nginx/html/index.html
55COPY logo.png /usr/share/nginx/html/logo.png
6-
7- # Copy nginx configuration
86COPY nginx.conf /etc/nginx/conf.d/default.conf
97
10- # Grant nginx user write access to runtime directories before dropping root
11- RUN mkdir -p /var/cache/nginx /var/run /var/log/nginx \
12- && chown -R nginx:nginx /var/cache/nginx /var/run /var/log/nginx \
13- && touch /var/run/nginx.pid \
14- && chown nginx:nginx /var/run/nginx.pid
15-
16- USER nginx
17-
18- EXPOSE 80
8+ EXPOSE 8080
199
2010HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
21- CMD wget -qO- http://localhost/health || exit 1
11+ CMD wget -qO- http://localhost:8080 /health || exit 1
Original file line number Diff line number Diff line change 11server {
2- listen 80 ;
3- listen [::]:80 ;
2+ listen 8080 ;
3+ listen [::]:8080 ;
44 server_name _;
55
66 root /usr/share/nginx/html;
Original file line number Diff line number Diff line change 1- FROM nginx:1.25-alpine
1+ # nginx:unprivileged runs as non-root (UID 101) on port 8080 — no permission hacks needed
2+ FROM nginxinc/nginx-unprivileged:1.25-alpine
23
3- # Copy static status page
44COPY index.html /usr/share/nginx/html/index.html
55COPY logo.png /usr/share/nginx/html/logo.png
6-
7- # Copy nginx configuration
86COPY nginx.conf /etc/nginx/conf.d/default.conf
97
10- # Grant nginx user write access to runtime directories before dropping root
11- RUN mkdir -p /var/cache/nginx /var/run /var/log/nginx \
12- && chown -R nginx:nginx /var/cache/nginx /var/run /var/log/nginx \
13- && touch /var/run/nginx.pid \
14- && chown nginx:nginx /var/run/nginx.pid
15-
16- USER nginx
17-
18- EXPOSE 80
8+ EXPOSE 8080
199
2010HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
21- CMD wget -qO- http://localhost/health || exit 1
11+ CMD wget -qO- http://localhost:8080 /health || exit 1
Original file line number Diff line number Diff line change 11server {
2- listen 80 ;
3- listen [::]:80 ;
2+ listen 8080 ;
3+ listen [::]:8080 ;
44 server_name _;
55
66 root /usr/share/nginx/html;
You can’t perform that action at this time.
0 commit comments