forked from fluxcd/helm-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b94dcca
commit 14e5bd9
Showing
1 changed file
with
17 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
# Build the manager binary | ||
FROM golang:1.13 as builder | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
|
||
# copy modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
|
||
# cache modules | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
# copy source code | ||
COPY main.go main.go | ||
COPY api/ api/ | ||
COPY controllers/ controllers/ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go | ||
# build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o helm-controller main.go | ||
|
||
FROM alpine:3.12 | ||
|
||
RUN apk add --no-cache ca-certificates tini | ||
|
||
COPY --from=builder /workspace/helm-controller /usr/local/bin/ | ||
|
||
RUN addgroup -S controller && adduser -S -g controller controller | ||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot | ||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
USER nonroot:nonroot | ||
USER controller | ||
|
||
ENTRYPOINT ["/manager"] | ||
ENTRYPOINT [ "/sbin/tini", "--", "helm-controller" ] |