File tree Expand file tree Collapse file tree 1 file changed +18
-14
lines changed
Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Original file line number Diff line number Diff line change 1- # Build the manager binary
21FROM golang:1.13 as builder
32
43WORKDIR /workspace
5- # Copy the Go Modules manifests
4+
5+ # copy modules manifests
66COPY go.mod go.mod
77COPY go.sum go.sum
8- # cache deps before building and copying source so that we don't need to re-download as much
9- # and so that source changes don't invalidate our downloaded layer
8+
9+ # cache modules
1010RUN go mod download
1111
12- # Copy the go source
12+ # copy source code
1313COPY main.go main.go
1414COPY api/ api/
1515COPY controllers/ controllers/
16+ COPY pkg/ pkg/
17+
18+ # build
19+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o source-watcher main.go
20+
21+ FROM alpine:3.12
22+
23+ RUN apk add --no-cache ca-certificates tini
24+
25+ COPY --from=builder /workspace/source-watcher /usr/local/bin/
1626
17- # Build
18- RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
27+ RUN addgroup -S controller && adduser -S -g controller controller
1928
20- # Use distroless as minimal base image to package the manager binary
21- # Refer to https://github.com/GoogleContainerTools/distroless for more details
22- FROM gcr.io/distroless/static:nonroot
23- WORKDIR /
24- COPY --from=builder /workspace/manager .
25- USER nonroot:nonroot
29+ USER controller
2630
27- ENTRYPOINT ["/manager" ]
31+ ENTRYPOINT [ "/sbin/tini" , "--" , "source-watcher" ]
You can’t perform that action at this time.
0 commit comments