From e87227a342f648a6df72cc98cafd00d0a37058ff Mon Sep 17 00:00:00 2001 From: Justin SB Date: Thu, 29 Nov 2018 14:30:03 -0500 Subject: [PATCH] Put the manager binary into /, instead of /root/ /root/ encourages use of the root user, and / is more the pattern I've seen for thin containers. --- pkg/scaffold/manager/config.go | 2 +- pkg/scaffold/manager/dockerfile.go | 4 ++-- test/project/Dockerfile | 4 ++-- test/project/config/manager/manager.yaml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/scaffold/manager/config.go b/pkg/scaffold/manager/config.go index 63c7f626115..83e5317586f 100644 --- a/pkg/scaffold/manager/config.go +++ b/pkg/scaffold/manager/config.go @@ -84,7 +84,7 @@ spec: spec: containers: - command: - - /root/manager + - /manager image: {{ .Image }} imagePullPolicy: Always name: manager diff --git a/pkg/scaffold/manager/dockerfile.go b/pkg/scaffold/manager/dockerfile.go index 7206082d5dd..272861e5371 100644 --- a/pkg/scaffold/manager/dockerfile.go +++ b/pkg/scaffold/manager/dockerfile.go @@ -50,7 +50,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager {{ .Repo }}/cmd # Copy the controller-manager into a thin image FROM ubuntu:latest -WORKDIR /root/ +WORKDIR / COPY --from=builder /go/src/{{ .Repo }}/manager . -ENTRYPOINT ["./manager"] +ENTRYPOINT ["/manager"] ` diff --git a/test/project/Dockerfile b/test/project/Dockerfile index 32003eec6b8..4d50c3ecf52 100644 --- a/test/project/Dockerfile +++ b/test/project/Dockerfile @@ -12,6 +12,6 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager sigs.k8s.io/kub # Copy the controller-manager into a thin image FROM ubuntu:latest -WORKDIR /root/ +WORKDIR / COPY --from=builder /go/src/sigs.k8s.io/kubebuilder/test/project/manager . -ENTRYPOINT ["./manager"] +ENTRYPOINT ["/manager"] diff --git a/test/project/config/manager/manager.yaml b/test/project/config/manager/manager.yaml index 5ca44d3d767..3935ac6b028 100644 --- a/test/project/config/manager/manager.yaml +++ b/test/project/config/manager/manager.yaml @@ -42,7 +42,7 @@ spec: spec: containers: - command: - - /root/manager + - /manager image: controller:latest imagePullPolicy: Always name: manager