Skip to content

Commit

Permalink
Merge pull request #155 from kubescape/distroless
Browse files Browse the repository at this point in the history
use distroless base image
  • Loading branch information
David Wertenteil authored Aug 9, 2023
2 parents c2ffc7d + 484b278 commit b8b6088
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM --platform=$BUILDPLATFORM golang:1.20-alpine as builder

ENV GO111MODULE=
ENV CGO_ENABLED=0
FROM --platform=$BUILDPLATFORM golang:1.20-bullseye as builder

ENV GO111MODULE=on CGO_ENABLED=0
WORKDIR /work
ARG TARGETOS TARGETARCH

Expand All @@ -11,11 +9,10 @@ RUN --mount=target=. \
--mount=type=cache,target=/go/pkg \
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/operator .

FROM alpine
FROM gcr.io/distroless/static-debian11:nonroot

RUN addgroup -S ks && adduser -S ks -G ks
USER ks
WORKDIR /home/ks/
USER nonroot
WORKDIR /home/nonroot/

COPY --from=builder /out/operator /usr/bin/operator

Expand Down

0 comments on commit b8b6088

Please sign in to comment.