Skip to content

Commit

Permalink
Merge pull request #20 from bork91/master
Browse files Browse the repository at this point in the history
Make image run non-root
  • Loading branch information
wacken89 authored Oct 3, 2024
2 parents 2301fcc + f874627 commit fd4aa3d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.8-slim

RUN addgroup --gid 11000 app && \
adduser -uid 11001 --disabled-login -gid 11000 --home /code app

COPY code /code
RUN pip install --no-cache-dir -r /code/requirements.txt

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

EXPOSE 8000

USER 11001

CMD ["python" , "-u", "/code/exporter.py"]
16 changes: 9 additions & 7 deletions deploy/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ env:
podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 11001
seccompProfile:
type: RuntimeDefault

service:
type: ClusterIP
Expand Down
9 changes: 9 additions & 0 deletions deploy/kubernetes-manifest/kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,14 @@ spec:
limits:
memory: "128Mi"
cpu: "250m"
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 11001
seccompProfile:
type: RuntimeDefault
ports:
- containerPort: 8000

0 comments on commit fd4aa3d

Please sign in to comment.