Skip to content

Commit a8215e6

Browse files
sxdjbattiato
authored andcommitted
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. <[email protected]>
1 parent 9d8fa07 commit a8215e6

File tree

3 files changed

+71
-9
lines changed

3 files changed

+71
-9
lines changed
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Barman Base Image
2+
on:
3+
pull_request:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * 0"
7+
8+
env:
9+
IMAGE_NAME: "ghcr.io/cloudnative-pg/plugin-barman-cloud-base"
10+
PLATFORMS: "linux/amd64,linux/arm64"
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
security-events: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
with:
29+
platforms: ${{ env.PLATFORMS }}
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Log in to the GitHub Container registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Build Docker Image
42+
uses: docker/build-push-action@v6
43+
with:
44+
platforms: ${{ env.PLATFORMS }}
45+
context: .
46+
file: ./containers/Dockerfile.barmanbase
47+
push: true
48+
tags: ${{ env.IMAGE_NAME }}:latest
49+
50+
- name: Run Snyk to check Docker image for vulnerabilities
51+
uses: snyk/actions/docker@master
52+
continue-on-error: true
53+
env:
54+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
55+
with:
56+
image: "${{ env.IMAGE_NAME }}:latest"
57+
args: --severity-threshold=high --file=./containers/Dockerfile.barmanbase
58+
-
59+
name: Upload result to GitHub Code Scanning
60+
uses: github/codeql-action/upload-sarif@v3
61+
with:
62+
sarif_file: snyk.sarif

containers/Dockerfile.barmanbase

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM python:3.13-slim AS pythonbuilder
2+
RUN apt-get update && \
3+
apt-get install -y postgresql-common build-essential && \
4+
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
5+
apt-get install -y libpq-dev && \
6+
pip install barman[azure,cloud,google,snappy]==3.11.1 setuptools

containers/Dockerfile.sidecar

+3-9
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,10 @@ COPY ../internal/ internal/
3030
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
3131
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/manager/main.go
3232

33-
# Build barman-cloud
33+
# Use plug-barman-cloud-base to get the dependencies
3434
# pip will build everything inside /usr/ since this is the case
35-
# we should build and then copy every file into a destination that will
36-
# then copy into the distroless container
37-
FROM python:3.13-slim AS pythonbuilder
38-
RUN apt-get update && \
39-
apt-get install -y postgresql-common build-essential && \
40-
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
41-
apt-get install -y libpq-dev && \
42-
pip install barman[azure,cloud,google,snappy]==3.11.1 setuptools
35+
# Copy every file into a destination that will then copy into the distroless container
36+
FROM ghcr.io/cloudnative-pg/plugin-barman-cloud-base:latest AS pythonbuilder
4337
# Prepare a new /usr/ directory with the files we'll need in the final image
4438
RUN mkdir /new-usr/ && \
4539
cp -r --parents /usr/local/lib/ /usr/lib/*-linux-gnu/ /usr/local/bin/ \

0 commit comments

Comments
 (0)