Skip to content

Commit 3d59564

Browse files
authored
Switch to nginx unprivileged (#84)
1 parent d391b46 commit 3d59564

File tree

4 files changed

+34
-20
lines changed

4 files changed

+34
-20
lines changed

Charts/web-conexs/templates/client_deployment.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,11 @@ spec:
2222
{{- toYaml .Values.api.resources | nindent 12 }}
2323
ports:
2424
- name: http
25-
containerPort: 80
25+
containerPort: 8081
26+
volumeMounts:
27+
- mountPath: /tmp
28+
name: tmp
29+
volumes:
30+
- emptyDir: {}
31+
name: tmp
2632
{{- end }}

Charts/web-conexs/templates/client_service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
- name: http
99
port: {{ .Values.global.client.port }}
1010
protocol: TCP
11-
targetPort: 80
11+
targetPort: 8081
1212
selector:
1313
app: {{ include "web-conexs.fullname" . }}-client
1414
type: {{ .Values.client.service.type }}

web-conexs-client/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#build api
33
#copy to runtime
44

5-
FROM node:18-bullseye-slim as build-web
5+
FROM node:23-bookworm-slim as build-web
66

77
WORKDIR /client
88

@@ -16,10 +16,10 @@ RUN yes | pnpm install
1616

1717
RUN pnpm vite build
1818

19-
From nginx as host
19+
From docker.io/nginxinc/nginx-unprivileged:alpine3.21-slim as host
2020

2121
COPY --from=build-web /client/dist/ /usr/share/nginx/html
2222
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
2323

24-
# change this entrypoint if it is not the same as the repo
24+
EXPOSE 8081
2525
ENTRYPOINT ["nginx","-g", "daemon off;"]

web-conexs-client/nginx/default.conf

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
1-
server {
2-
listen 80;
3-
server_name localhost;
1+
pid /tmp/nginx.pid;
42

5-
#access_log /var/log/nginx/host.access.log main;
3+
http {
4+
include mime.types;
5+
client_body_temp_path /tmp/client_temp;
6+
proxy_temp_path /tmp/proxy_temp_path;
7+
fastcgi_temp_path /tmp/fastcgi_temp;
8+
uwsgi_temp_path /tmp/uwsgi_temp;
9+
scgi_temp_path /tmp/scgi_temp;
10+
11+
server {
12+
listen 8081;
613

714

8-
location / {
9-
root /usr/share/nginx/html;
10-
index index.html index.htm;
11-
try_files $uri /index.html =404;
12-
}
15+
location / {
16+
root /usr/share/nginx/html;
17+
index index.html index.htm;
18+
try_files $uri /index.html =404;
19+
}
1320

14-
#error_page 404 /404.html;
21+
#error_page 404 /404.html;
1522

16-
# redirect server error pages to the static page /50x.html
17-
#
18-
error_page 500 502 503 504 /50x.html;
19-
location = /50x.html {
20-
root /usr/share/nginx/html;
23+
# redirect server error pages to the static page /50x.html
24+
#
25+
error_page 500 502 503 504 /50x.html;
26+
location = /50x.html {
27+
root /usr/share/nginx/html;
28+
}
2129
}
2230

2331

0 commit comments

Comments
 (0)