Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
FROM debian:stretch-slim
FROM golang:1.13-alpine as builder

ENV USER=event_exporter
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}" && \
apk update && apk add --no-cache git ca-certificates gcc

FROM scratch

COPY bin/event_exporter /
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

USER nobody
USER event-exporter

ENTRYPOINT ["/event_exporter"]

Expand Down
3 changes: 3 additions & 0 deletions deploy/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ spec:
labels:
app: event-exporter
spec:
securityContext:
runAsNonRoot: true
runAsUser: 10001
containers:
- name: event-exporter
image: 'caicloud/event-exporter:v1.0.0'
Expand Down