Skip to content

Commit dc1bce1

Browse files
sfox-equinixstephen-fox
authored andcommitted
dockerfile: Use distroless image. Run as non-root user.
1 parent f919a59 commit dc1bce1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ COPY internal ./internal
1212
COPY processors ./processors
1313
COPY main.go .
1414

15-
RUN go build -o audito-maldito
15+
RUN CGO_ENABLED=0 go build -o audito-maldito
1616

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

23-
COPY --from=builder /go/src/audito-maldito/audito-maldito /usr/bin/audito-maldito
19+
COPY --from=builder /go/src/audito-maldito/audito-maldito /
2420

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

0 commit comments

Comments
 (0)