Skip to content

Commit

Permalink
Merge pull request #1 from max-rocket-internet/non_root
Browse files Browse the repository at this point in the history
switching to use non-root user and read-only file system
  • Loading branch information
max-rocket-internet authored Jun 12, 2019
2 parents f95958a + 917475b commit 88a8bdb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ WORKDIR /go/src/github.com/deliveryhero/k8s-event-logger
COPY main.go .
RUN go get -d -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

RUN adduser --disabled-login --no-create-home --disabled-password --system --uid 101 non-root
FROM alpine:3.9.3
RUN apk --no-cache add ca-certificates
WORKDIR /root/
WORKDIR /
COPY --from=0 /go/src/github.com/deliveryhero/k8s-event-logger/main k8s-event-logger
CMD ["/root/k8s-event-logger"]
USER 101
ENV USER non-root
CMD ["/k8s-event-logger"]
3 changes: 3 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
- name: app
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
Expand Down
2 changes: 1 addition & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image:
repository: tools4k8s/k8s-event-logger
tag: "1.2"
tag: "1.3"
pullPolicy: IfNotPresent

resources:
Expand Down

0 comments on commit 88a8bdb

Please sign in to comment.