From 1e2dd0084c1175836a2762677eafff644be63ab0 Mon Sep 17 00:00:00 2001 From: Leonardo Cecchi Date: Fri, 4 Oct 2024 15:53:04 +0200 Subject: [PATCH] chore: review Signed-off-by: Leonardo Cecchi --- containers/Dockerfile.plugin | 5 +++-- containers/Dockerfile.sidecar | 1 + internal/cnpgi/operator/lifecycle.go | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/containers/Dockerfile.plugin b/containers/Dockerfile.plugin index 20dcda5..b5b4cea 100644 --- a/containers/Dockerfile.plugin +++ b/containers/Dockerfile.plugin @@ -12,7 +12,7 @@ COPY ../go.sum go.sum RUN go mod download # Copy the go source -COPY ../cmd/instance/main.go cmd/instance/main.go +COPY ../cmd/operator/main.go cmd/operator/main.go COPY ../api api/ COPY ../internal internal/ @@ -21,7 +21,8 @@ COPY ../internal internal/ # was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO # the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/instance/main.go +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \ + CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/operator/main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details diff --git a/containers/Dockerfile.sidecar b/containers/Dockerfile.sidecar index 7bdb059..98ee93b 100644 --- a/containers/Dockerfile.sidecar +++ b/containers/Dockerfile.sidecar @@ -24,3 +24,4 @@ FROM gcr.io/distroless/python3:debug COPY --from=pythonbuilder /new-usr/* /usr/ COPY --from=gobuilder /build/instance /usr/local/bin/instance USER 26:26 +ENTRYPOINT ["/usr/local/bin/instance"] diff --git a/internal/cnpgi/operator/lifecycle.go b/internal/cnpgi/operator/lifecycle.go index 3c44eb7..56c3e75 100644 --- a/internal/cnpgi/operator/lifecycle.go +++ b/internal/cnpgi/operator/lifecycle.go @@ -85,6 +85,9 @@ func (impl LifecycleImplementation) LifecycleHook( Value: "/controller/wal-restore-spool", }, }, + Command: []string{ + "/usr/local/bin/instance", + }, }, true) if err != nil { return nil, err