Skip to content

Commit

Permalink
Merge pull request #26 from barcostreams/run-as-non-root
Browse files Browse the repository at this point in the history
Run as non-root and set security context
  • Loading branch information
jorgebay authored Sep 21, 2022
2 parents 8e5fab0 + 3d1ddb1 commit 6e2e82e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/docs
/build
9 changes: 9 additions & 0 deletions build/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@ LABEL org.opencontainers.image.description="Lightweight, elastic, kubernetes-nat

WORKDIR /work/
COPY --from=builder /build/barco .

RUN mkdir /var/lib/barco

RUN chgrp -R 0 /var/lib/barco && \
chmod -R g=u /var/lib/barco && \
chown -R 1001:0 /var/lib/barco

USER 1001

CMD ["/work/barco"]
8 changes: 8 additions & 0 deletions deploy/kubernetes/barco.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ spec:
- name: barco
image: barcostreams/barco:dev1
imagePullPolicy: Always
securityContext:
seccompProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
allowPrivilegeEscalation: false
runAsNonRoot: true
ports:
- containerPort: 9250
name: discovery
Expand Down

0 comments on commit 6e2e82e

Please sign in to comment.