Skip to content

Commit fd4aa3d

Browse files
authored
Merge pull request #20 from bork91/master
Make image run non-root
2 parents 2301fcc + f874627 commit fd4aa3d

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM python:3.8-slim
22

3+
RUN addgroup --gid 11000 app && \
4+
adduser -uid 11001 --disabled-login -gid 11000 --home /code app
5+
36
COPY code /code
47
RUN pip install --no-cache-dir -r /code/requirements.txt
58

@@ -8,4 +11,6 @@ ENV PYTHONPATH '/code/'
811

912
EXPOSE 8000
1013

14+
USER 11001
15+
1116
CMD ["python" , "-u", "/code/exporter.py"]

deploy/helm-chart/values.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ env:
5454
podSecurityContext: {}
5555
# fsGroup: 2000
5656

57-
securityContext: {}
58-
# capabilities:
59-
# drop:
60-
# - ALL
61-
# readOnlyRootFilesystem: true
62-
# runAsNonRoot: true
63-
# runAsUser: 1000
57+
securityContext:
58+
capabilities:
59+
drop:
60+
- ALL
61+
readOnlyRootFilesystem: true
62+
runAsNonRoot: true
63+
runAsUser: 11001
64+
seccompProfile:
65+
type: RuntimeDefault
6466

6567
service:
6668
type: ClusterIP

deploy/kubernetes-manifest/kubernetes.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,14 @@ spec:
4646
limits:
4747
memory: "128Mi"
4848
cpu: "250m"
49+
securityContext:
50+
capabilities:
51+
drop:
52+
- ALL
53+
readOnlyRootFilesystem: true
54+
runAsNonRoot: true
55+
runAsUser: 11001
56+
seccompProfile:
57+
type: RuntimeDefault
4958
ports:
5059
- containerPort: 8000

0 commit comments

Comments
 (0)