Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerfile: Use distroless image. Run as non-root user. #104

Merged
merged 1 commit into from
Jul 21, 2023
Merged
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
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ COPY internal ./internal
COPY processors ./processors
COPY main.go .

RUN go build -o audito-maldito
RUN CGO_ENABLED=0 go build -o audito-maldito

# Not using distroless nor scratch because we need the systemd shared libraries
FROM ubuntu:22.04
# NOTE(jaosorior): Yes, we need to be the root user for this case.
# We need access to the journal's privileged log entries and the audit log in the future.
USER 0
FROM gcr.io/distroless/static:nonroot

COPY --from=builder /go/src/audito-maldito/audito-maldito /usr/bin/audito-maldito
COPY --from=builder /go/src/audito-maldito/audito-maldito /

ENTRYPOINT [ "/usr/bin/audito-maldito" ]
# "NONROOT" comes from distroless:
# https://github.com/GoogleContainerTools/distroless/blob/main/base/base.bzl
USER 65532:65532

ENTRYPOINT [ "/audito-maldito" ]
Loading