Skip to content

Commit 468d0b6

Browse files
committed
Make the frontend container run as a non-root user
1 parent f1068cc commit 468d0b6

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

Dockerfile.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ DISABLE_SOURCE_MAPS="${DISABLE_SOURCE_MAPS}" \
3636
UI_APP_CONFIG="${UI_APP_CONFIG}" \
3737
SOURCE_MAPS_TOKEN="${SOURCE_MAPS_TOKEN}" yarn run build:cvat-ui
3838

39-
FROM nginx:1.28.0-alpine3.21-slim
39+
FROM nginxinc/nginx-unprivileged:1.28.0-alpine3.21-slim
4040

4141
# Replace default.conf configuration to remove unnecessary rules
42-
COPY cvat-ui/react_nginx.conf /etc/nginx/conf.d/default.conf
42+
COPY --chown=nginx:root cvat-ui/react_nginx.conf /etc/nginx/conf.d/default.conf
4343
COPY cvat-ui/robots.txt /usr/share/nginx/html/
4444
COPY --from=cvat-ui /tmp/cvat-ui/dist /usr/share/nginx/html/

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ services:
252252
- cvat_server
253253
labels:
254254
traefik.enable: "true"
255-
traefik.http.services.cvat-ui.loadbalancer.server.port: "80"
255+
traefik.http.services.cvat-ui.loadbalancer.server.port: "8000"
256256
traefik.http.routers.cvat-ui.rule: Host(`${CVAT_HOST:-localhost}`)
257257
traefik.http.routers.cvat-ui.entrypoints: web
258258
networks:

helm-chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type: application
1616
# This is the chart version. This version number should be incremented each time you make changes
1717
# to the chart and its templates, including the app version.
1818
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19-
version: 0.15.0
19+
version: 0.15.1
2020

2121
# This is the version number of the application being deployed. This version number should be
2222
# incremented each time you make changes to the application. Versions are not expected to

helm-chart/templates/cvat_frontend/deployment.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,29 @@ spec:
3939
{{- toYaml . | nindent 12 }}
4040
{{- end }}
4141
ports:
42-
- containerPort: 80
42+
- containerPort: 8000
4343
{{- with .Values.cvat.frontend.additionalEnv }}
4444
env:
4545
{{- toYaml . | nindent 10 }}
4646
{{- end }}
4747
{{- if .Values.cvat.frontend.readinessProbe.enabled }}
4848
readinessProbe:
4949
tcpSocket:
50-
port: 80
50+
port: 8000
5151
{{- toYaml (omit .Values.cvat.frontend.readinessProbe "enabled") | nindent 12 }}
5252
{{- end }}
5353
{{- if .Values.cvat.frontend.livenessProbe.enabled }}
5454
livenessProbe:
5555
tcpSocket:
56-
port: 80
56+
port: 8000
5757
{{- toYaml (omit .Values.cvat.frontend.livenessProbe "enabled") | nindent 12 }}
5858
{{- end }}
5959
{{- with .Values.cvat.frontend.additionalVolumeMounts }}
6060
volumeMounts:
6161
{{- toYaml . | nindent 10 }}
6262
{{- end }}
63+
securityContext:
64+
runAsNonRoot: true
6365
{{- with .Values.cvat.frontend.additionalVolumes }}
6466
volumes:
6567
{{- toYaml . | nindent 8 }}

helm-chart/templates/ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ spec:
3434
service:
3535
name: {{ $.Release.Name }}-backend-service
3636
port:
37-
number: 8080
37+
name: http
3838
{{- end }}
3939
- path: /
4040
pathType: Prefix
4141
backend:
4242
service:
4343
name: {{ .Release.Name }}-frontend-service
4444
port:
45-
number: 80
45+
name: http
4646
{{- end }}

helm-chart/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ cvat:
211211
service:
212212
type: ClusterIP
213213
ports:
214-
- port: 80
215-
targetPort: 80
214+
- port: 8000
215+
targetPort: 8000
216216
protocol: TCP
217217
name: http
218218
opa:

0 commit comments

Comments
 (0)