-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #691 from droot/bugfix/v2-scaffolding-dockerfile
:bugfix: fixed docker image file for v2 scaffolding
- Loading branch information
Showing
2 changed files
with
24 additions
and
16 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
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,18 +1,22 @@ | ||
# Build the manager binary | ||
FROM golang:1.10.3 as builder | ||
FROM golang:1.12.5 as builder | ||
|
||
# Copy in the go src | ||
WORKDIR /go/src/sigs.k8s.io/kubebuilder/testdata/project_v2 | ||
COPY vendor/ vendor/ | ||
WORKDIR /workspace | ||
# Copy the go source | ||
COPY main.go main.go | ||
COPY api/ api/ | ||
COPY controllers/ controllers/ | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
|
||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager sigs.k8s.io/kubebuilder/testdata/project_v2/ | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go | ||
|
||
# Copy the controller-manager into a thin image | ||
FROM ubuntu:latest | ||
# 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/base | ||
WORKDIR / | ||
COPY --from=builder /go/src/sigs.k8s.io/kubebuilder/testdata/project_v2/manager . | ||
COPY --from=builder /workspace/manager . | ||
ENTRYPOINT ["/manager"] |