Skip to content

Commit

Permalink
Merge 850704e into 3d06a02
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost authored May 22, 2019
2 parents 3d06a02 + 850704e commit 833a75e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ FROM golang:1.12.5 as builder
ARG ARCH

# Copy in the go src
WORKDIR $GOPATH/src/sigs.k8s.io/cluster-api
WORKDIR ${GOPATH}/src/sigs.k8s.io/cluster-api
COPY pkg/ pkg/
COPY cmd/ cmd/
COPY vendor/ vendor/

#create non-root user
RUN groupadd -g 999 cluster-api-manager && \
useradd -r -u 999 -g cluster-api-manager cluster-api-manager

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -ldflags '-extldflags "-static"' -o manager sigs.k8s.io/cluster-api/cmd/manager

# Copy the controller-manager into a thin image
FROM gcr.io/distroless/static:latest
WORKDIR /
COPY --from=builder /go/src/sigs.k8s.io/cluster-api/manager .
COPY --from=builder /etc/passwd /etc/passwd
USER cluster-api-manager
ENTRYPOINT ["/manager"]

0 comments on commit 833a75e

Please sign in to comment.