Skip to content

Commit 1b999cb

Browse files
author
Phillip Wittrock
authored
Merge pull request #65 from fanzhangio/issue55
Set ENTRYPOINT and CMD for Dockerfile.controller
2 parents 1ccaeea + 2806d6b commit 1b999cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/kubebuilder/initproject/dockerfile.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,16 @@ COPY cmd/ cmd/
8585
COPY vendor/ vendor/
8686
8787
# Build and test the API code
88-
RUN go build -a -o controller-manager ./cmd/controller-manager/main.go
88+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o controller-manager ./cmd/controller-manager/main.go
8989
RUN go test ./pkg/... ./cmd/...
9090
9191
# Copy the controller-manager into a thin image
92-
FROM ubuntu:latest
92+
FROM scratch
9393
# RUN apk --no-cache add ca-certificates
9494
WORKDIR /root/
9595
COPY --from=builder /go/src/{{ .Repo }}/controller-manager .
96-
CMD ["./controller-manager", "--install-crds=false"]
96+
ENTRYPOINT ["./controller-manager"]
97+
CMD ["--install-crds=false"]
9798
`
9899

99100
//var apiserverDockerfileTemplate = `# Instructions to install API using the installer

0 commit comments

Comments
 (0)