Skip to content

Commit

Permalink
fixchanges to make nginx rootless (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvarin authored Oct 18, 2024
1 parent c8efe34 commit 7ee2545
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,16 @@ COPY --from=installer /app/apps/documentation/out /usr/share/nginx/html
# Copy the Nginx configuration file
COPY --from=builder /app/apps/documentation/nginx.conf /etc/nginx/conf.d/default.conf

# support running as arbitrary user which belogs to the root group
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx && \
chown nginx.root /var/cache/nginx /var/run /var/log/nginx && \
# comment user directive as master process is run as user in OpenShift anyhow
sed -i.bak 's/^user/#user/' /etc/nginx/nginx.conf && \
# Make /etc/nginx/html/ available to use
mkdir -p /etc/nginx/html/ && chmod 777 /etc/nginx/html/

# Expose port 80
EXPOSE 80
EXPOSE 8080

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
4 changes: 2 additions & 2 deletions apps/documentation/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 80;
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
Expand All @@ -23,4 +23,4 @@ server {
location = /404.html {
internal;
}
}
}

0 comments on commit 7ee2545

Please sign in to comment.