mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-11 21:23:12 +01:00
fix: rebase changes
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
This commit is contained in:
parent
53be5ae896
commit
4bd0f2ab63
@ -1,5 +1,5 @@
|
|||||||
# Build the manager binary
|
# Build the manager binary
|
||||||
FROM golang:1.23 AS builder
|
FROM --platform=$BUILDPLATFORM golang:1.23.1 AS gobuilder
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ LABEL summary="$SUMMARY" \
|
|||||||
release="1"
|
release="1"
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=builder /workspace/manager .
|
COPY --from=gobuilder /workspace/manager .
|
||||||
USER 65532:65532
|
USER 65532:65532
|
||||||
|
|
||||||
ENTRYPOINT ["/manager"]
|
ENTRYPOINT ["/manager"]
|
||||||
@ -4,6 +4,32 @@
|
|||||||
# * instance plugin
|
# * instance plugin
|
||||||
# Both components are built before going into a distroless container
|
# Both components are built before going into a distroless container
|
||||||
|
|
||||||
|
# Build the manager binary
|
||||||
|
FROM --platform=$BUILDPLATFORM golang:1.23.1 AS gobuilder
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
# Copy the Go Modules manifests
|
||||||
|
COPY ../go.mod go.mod
|
||||||
|
COPY ../go.sum go.sum
|
||||||
|
# cache deps before building and copying source so that we don't need to re-download as much
|
||||||
|
# and so that source changes don't invalidate our downloaded layer
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy the go source
|
||||||
|
COPY ../cmd/manager/main.go cmd/manager/main.go
|
||||||
|
COPY ../api/ api/
|
||||||
|
COPY ../internal/ internal/
|
||||||
|
|
||||||
|
# Build
|
||||||
|
# the GOARCH has not a default value to allow the binary be built according to the host where the command
|
||||||
|
# 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 --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/manager/main.go
|
||||||
|
|
||||||
# Build barman-cloud
|
# Build barman-cloud
|
||||||
# pip will build everything inside /usr/ since this is the case
|
# pip will build everything inside /usr/ since this is the case
|
||||||
# we should build and then copy every file into a destination that will
|
# we should build and then copy every file into a destination that will
|
||||||
@ -19,17 +45,6 @@ RUN mkdir /new-usr/ && \
|
|||||||
cp -r --parents /usr/local/lib/ /usr/lib/*-linux-gnu/ /usr/local/bin/ \
|
cp -r --parents /usr/local/lib/ /usr/lib/*-linux-gnu/ /usr/local/bin/ \
|
||||||
/new-usr/
|
/new-usr/
|
||||||
|
|
||||||
# Build instance
|
|
||||||
# This step builds a simple instance app that will manage and handle
|
|
||||||
# the barman-cloud commands inside the sidecar
|
|
||||||
FROM --platform=$BUILDPLATFORM golang:1.23.1 AS gobuilder
|
|
||||||
ENV CGO_ENABLED=0
|
|
||||||
COPY .. /src
|
|
||||||
ARG TARGETOS
|
|
||||||
ARG TARGETARCH
|
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
|
|
||||||
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -C /src -o /build/instance /src/cmd/instance/main.go
|
|
||||||
|
|
||||||
# Joint process
|
# Joint process
|
||||||
# Now we put everything that was build from the origin into our
|
# Now we put everything that was build from the origin into our
|
||||||
# distroless container
|
# distroless container
|
||||||
@ -49,6 +64,6 @@ LABEL summary="$SUMMARY" \
|
|||||||
release="1"
|
release="1"
|
||||||
|
|
||||||
COPY --from=pythonbuilder /new-usr/* /usr/
|
COPY --from=pythonbuilder /new-usr/* /usr/
|
||||||
COPY --from=gobuilder /build/instance /usr/local/bin/instance
|
COPY --from=gobuilder /workspace/manager /manager
|
||||||
USER 26:26
|
USER 26:26
|
||||||
ENTRYPOINT ["/usr/local/bin/instance"]
|
ENTRYPOINT ["/manager"]
|
||||||
|
|||||||
@ -231,8 +231,8 @@ func reconcilePodSpec(
|
|||||||
sidecarConfig.Name = "plugin-barman-cloud"
|
sidecarConfig.Name = "plugin-barman-cloud"
|
||||||
sidecarConfig.Image = viper.GetString("sidecar-image")
|
sidecarConfig.Image = viper.GetString("sidecar-image")
|
||||||
sidecarConfig.ImagePullPolicy = cluster.Spec.ImagePullPolicy
|
sidecarConfig.ImagePullPolicy = cluster.Spec.ImagePullPolicy
|
||||||
sidecarConfig.Command= []string{
|
sidecarConfig.Command = []string{
|
||||||
"/usr/local/bin/instance",
|
"/manager",
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge the main container envs if they aren't already set
|
// merge the main container envs if they aren't already set
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user