Skip to content

Commit

Permalink
Reduce docker privilages to use non-root for FE (#122)
Browse files Browse the repository at this point in the history
* Update Dockerfile

Signed-off-by: Arun Cherla <[email protected]>

* Update nginx.conf

Signed-off-by: Arun Cherla <[email protected]>

* Update docker-compose.yml

Signed-off-by: Arun Cherla <[email protected]>

---------

Signed-off-by: Arun Cherla <[email protected]>
  • Loading branch information
acherla authored Aug 19, 2024
1 parent 458f9f2 commit 8eb2677
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ services:
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public

- traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=80
- traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=8080

- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=Host(`${DOMAIN?Variable not set}`, `www.${DOMAIN?Variable not set}`)
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.entrypoints=http
Expand Down
3 changes: 2 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ RUN npm run build


# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1
FROM nginxinc/nginx-unprivileged:stable-alpine3.19

COPY --from=build-stage /app/dist/ /usr/share/nginx/html

COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY ./nginx-backend-not-found.conf /etc/nginx/extra-conf.d/backend-not-found.conf
VOLUME ["/etc", "/tmp"]
2 changes: 1 addition & 1 deletion frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 80;
listen 8080;

location / {
root /usr/share/nginx/html;
Expand Down

0 comments on commit 8eb2677

Please sign in to comment.