From f467bc887f99a2b172e9e1b13194dbfd4b8d5b01 Mon Sep 17 00:00:00 2001 From: "Jonathan Gonzalez V." Date: Tue, 19 Nov 2024 14:00:24 +0100 Subject: [PATCH] chore: add Barman base image Now we build an image every week with the base packages required for the sidecar, the idea is to reduce the amount of time of every CI process requires to run. Signed-off-by: Jonathan Gonzalez V. --- containers/Dockerfile.sidecar | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/containers/Dockerfile.sidecar b/containers/Dockerfile.sidecar index bacb5f4..8314c31 100644 --- a/containers/Dockerfile.sidecar +++ b/containers/Dockerfile.sidecar @@ -33,17 +33,10 @@ COPY ../internal/ internal/ 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 +# Use plug-barman-cloud-base to get the dependencies # pip will build everything inside /usr/ since this is the case -# we should build and then copy every file into a destination that will -# then copy into the distroless container -FROM python:3.13-slim-bookworm AS pythonbuilder -COPY containers/sidecar-requirements.txt . -RUN apt-get update && \ - apt-get install -y postgresql-common build-essential && \ - /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \ - apt-get install -y libpq-dev && \ - pip install -r sidecar-requirements.txt +# Copy every file into a destination that will then copy into the distroless container +FROM ghcr.io/cloudnative-pg/plugin-barman-cloud-base:latest AS pythonbuilder # Prepare a new /usr/ directory with the files we'll need in the final image RUN mkdir /new-usr/ && \ cp -r --parents /usr/local/lib/ /usr/lib/*-linux-gnu/ /usr/local/bin/ \