Skip to content

Commit d7bfbbb

Browse files
authored
fix: dockerfile: use unprivileged nginx (#1657)
This allows running this container w/ arbitrary uid support ## Description Short description of the pull request ## Motivation running SciCat in an OpenShift environment w/ arbitrary uids ## Fixes: * nginx unprivileged ## Changes: * unprivileged port 8080 ## Summary by Sourcery Use the unprivileged nginx image to support running the container with arbitrary user IDs, and update the exposed port to 8080. Build: - Switch to using the nginxinc/nginx-unprivileged base image in the Dockerfile. CI: - Update the docker-compose configuration to expose port 8080 instead of 80.
2 parents 0d887e5 + 869814c commit d7bfbbb

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

CI/e2e/docker-compose.e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ services:
4848
build:
4949
context: .
5050
ports:
51-
- 4200:80
51+
- 4200:8080
5252
volumes:
5353
- "./CI/e2e/frontend.config.e2e.json:/usr/share/nginx/html/assets/config.json"
5454
depends_on:

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ RUN npm ci
88
COPY . /frontend/
99
RUN npx ng build
1010

11-
FROM nginx:1.28-alpine
11+
FROM docker.io/nginxinc/nginx-unprivileged:1.26.3
12+
USER root
1213
RUN rm -rf /usr/share/nginx/html/*
1314
COPY --from=builder /frontend/dist/browser/ /usr/share/nginx/html/
1415
COPY scripts/nginx.conf /etc/nginx/nginx.conf
15-
EXPOSE 80
16+
USER 101
17+
COPY --from=builder /frontend/dist/ /usr/share/nginx/html/
18+
EXPOSE 8080

scripts/nginx.conf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
# * Official English Documentation: http://nginx.org/en/docs/
33
# * Official Russian Documentation: http://nginx.org/ru/docs/
44

5-
user nginx;
65
worker_processes auto;
76
error_log /var/log/nginx/error.log;
8-
pid /run/nginx.pid;
7+
pid /tmp/nginx.pid;
98

109
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
1110
include /usr/share/nginx/modules/*.conf;
@@ -31,8 +30,8 @@ http {
3130
default_type application/octet-stream;
3231

3332
server {
34-
listen 80 default_server;
35-
listen [::]:80 default_server;
33+
listen 8080 default_server;
34+
listen [::]:8080 default_server;
3635
server_name _;
3736
root /usr/share/nginx/html;
3837

0 commit comments

Comments
 (0)