Skip to content

Commit

Permalink
image nginx unprivileged
Browse files Browse the repository at this point in the history
  • Loading branch information
cdebarros committed Dec 5, 2023
1 parent 7a6beee commit ecdc079
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# This dockerfile should work for all traditional apps,
# i.e. it only sets up a nginx server with the app dist folder

FROM nginx:1.24-alpine
FROM nginxinc/nginx-unprivileged:1.24

USER root
RUN rm -rf /usr/share/nginx/html/*
USER nginx

ARG APP_NAME="search"
ENV APP_NAME=${APP_NAME}
Expand All @@ -21,6 +25,6 @@ COPY tools/webcomponent/wc-embedder.html /usr/share/nginx/html/${APP_NAME}
COPY tools/docker/nginx.ign.conf /etc/nginx/conf.d/default.conf
RUN sed -i "s/APP_NAME/${APP_NAME}/" /etc/nginx/conf.d/default.conf

EXPOSE 80
EXPOSE 8080

ENTRYPOINT ["sh", "/docker-entrypoint.sh", "nginx", "-g", "daemon off;"]
10 changes: 8 additions & 2 deletions tools/docker/nginx.ign.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {
listen 80;
listen [::]:80;
listen 8080;
listen [::]:8080;
server_name localhost;

root /usr/share/nginx/html/datahub;
Expand All @@ -22,6 +22,12 @@ server {
add_header Cache-Control 'max-age=86400'; # 24h
}

location /catalogue {
try_files $uri$args $uri$args/ /index.html;

add_header Cache-Control 'max-age=86400'; # 24h
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
Expand Down

0 comments on commit ecdc079

Please sign in to comment.