Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .github/workflows/barman-base-image.yml

This file was deleted.

28 changes: 0 additions & 28 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,34 +381,6 @@ tasks:
build --dir . --file containers/Dockerfile.sidecar --platform linux/amd64 --platform linux/arm64
publish --ref {{.SIDECAR_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}

publish-barman-base:
desc: Build and publish a barman-cloud base container image
vars:
BARMAN_BASE_IMAGE_NAME: ghcr.io/{{.GITHUB_REPOSITORY}}-base{{if not (hasPrefix "refs/heads/main" .GITHUB_REF)}}-testing{{end}}
BARMAN_VERSION:
sh: grep "^barman" containers/sidecar-requirements.in | sed -E 's/.*==([^ ]+)/\1/'
BUILD_DATE:
sh: date +"%Y%m%d%H%M"
requires:
# We expect this to run in a GitHub workflow, so we put a few GitHub-specific vars here
# to prevent running this task locally by accident.
vars:
- CI
- GITHUB_REPOSITORY
- GITHUB_REF
- GITHUB_REF_NAME
- REGISTRY_USER
- REGISTRY_PASSWORD
env:
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
cmds:
- >
dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
build --dir . --file containers/Dockerfile.barmanbase --platform linux/amd64 --platform linux/arm64
publish --ref {{.BARMAN_BASE_IMAGE_NAME}} --tags "{{.BARMAN_VERSION}}-{{.BUILD_DATE}}"

controller-gen:
desc: Run controller-gen
run: once
Expand Down
7 changes: 0 additions & 7 deletions containers/Dockerfile.barmanbase

This file was deleted.

58 changes: 44 additions & 14 deletions containers/Dockerfile.sidecar
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# The container needs to provide and build two components:
# * barman-cloud
# * instance plugin
# Both components are built before going into a distroless container
# Both components are built before going into the final container

# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.25.6 AS gobuilder
Expand Down Expand Up @@ -33,19 +33,30 @@ 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

# Use plugin-barman-cloud-base to get the dependencies.
# pip will build everything inside /usr, so we copy every file into a new
# destination that will then be copied into the distroless container
FROM ghcr.io/cloudnative-pg/plugin-barman-cloud-base:3.17.0-202601131704 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/ \
/new-usr/
# Build wheel files for Python dependencies
FROM python:3.13-slim-trixie AS pythonbuilder
WORKDIR /build

# Joint process
# Now we put everything that was build from the origin into our
# distroless container
FROM gcr.io/distroless/python3-debian12:nonroot
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-common \
build-essential && \
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
apt-get install -y --no-install-recommends \
libpq-dev \
liblz4-dev \
libsnappy-dev

# Copy requirements
COPY containers/sidecar-requirements.txt .

# Build wheels with pip cache mount
RUN --mount=type=cache,target=/root/.cache/pip \
pip wheel --wheel-dir=/wheels -r sidecar-requirements.txt

# Final sidecar image
FROM python:3.13-slim-trixie

ENV SUMMARY="CloudNativePG Barman plugin" \
DESCRIPTION="Container image that provides the barman-cloud sidecar"
Expand All @@ -60,7 +71,26 @@ LABEL summary="$SUMMARY" \
version="" \
release="1"

COPY --from=pythonbuilder /new-usr/* /usr/
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-common && \
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
apt-get install -y --no-install-recommends \
libpq5 \
liblz4-1 \
libsnappy1v5 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install wheels using bind mount (wheels not included in final layers)
# and ensure all Python bytecode is freshly compiled with correct timestamps
RUN --mount=type=bind,from=pythonbuilder,source=/wheels,target=/wheels \
pip install --no-cache-dir /wheels/*.whl && \
python -m compileall -q

# Copy Go manager binary
COPY --from=gobuilder /workspace/manager /manager

USER 26:26
ENTRYPOINT ["/manager"]
6 changes: 0 additions & 6 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@
enabled: false,
},
packageRules: [
{
matchPackageNames: [
'ghcr.io/cloudnative-pg/plugin-barman-cloud-base',
],
versioning: 'loose',
},
{
matchDatasources: [
'go',
Expand Down
Loading