Skip to content

Commit a3ca353

Browse files
sxdNiccoloFei
andauthored
chore: add Barman base image (#59)
We build a new image every week with the necessary base packages for the sidecar. This aims to reduce the time required for each CI process to run. Signed-off-by: Jonathan Gonzalez V. <[email protected]> Signed-off-by: Niccolò Fei <[email protected]> Co-authored-by: Niccolò Fei <[email protected]>
1 parent 0ef6423 commit a3ca353

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Barman Base Image
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 0 * * 0"
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- 'containers/sidecar-requirements.txt'
11+
12+
permissions: read-all
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
packages: write
19+
contents: write
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Install QEMU static binaries
24+
uses: docker/setup-qemu-action@v3
25+
- name: Install Task
26+
uses: arduino/setup-task@v2
27+
- name: Install Dagger
28+
env:
29+
# renovate: datasource=github-tags depName=dagger/dagger versioning=semver
30+
DAGGER_VERSION: 0.18.5
31+
run: |
32+
curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh
33+
- name: Publish a barman-base
34+
env:
35+
REGISTRY_USER: ${{ github.actor }}
36+
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
task publish-barman-base

Taskfile.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,33 @@ tasks:
377377
build --dir . --file containers/Dockerfile.sidecar --platform linux/amd64 --platform linux/arm64
378378
publish --ref {{.SIDECAR_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}
379379
380+
publish-barman-base:
381+
desc: Build and publish a barman-cloud base container image
382+
vars:
383+
BARMAN_BASE_IMAGE_NAME: ghcr.io/{{.GITHUB_REPOSITORY}}-base{{if not (hasPrefix "refs/heads/main" .GITHUB_REF)}}-testing{{end}}
384+
BARMAN_VERSION:
385+
sh: grep "^barman" containers/sidecar-requirements.in | sed -E 's/.*==([^ ]+)/\1/'
386+
BUILD_DATE:
387+
sh: date +"%Y%m%d%H%M"
388+
requires:
389+
# We expect this to run in a GitHub workflow, so we put a few GitHub-specific vars here
390+
# to prevent running this task locally by accident.
391+
vars:
392+
- CI
393+
- GITHUB_REPOSITORY
394+
- GITHUB_REF
395+
- GITHUB_REF_NAME
396+
- REGISTRY_USER
397+
- REGISTRY_PASSWORD
398+
env:
399+
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
400+
DAGGER_DOCKER_SHA: bba3a4ee46fd663a5577337e2221db56c646a0b7
401+
cmds:
402+
- >
403+
dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
404+
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
405+
build --dir . --file containers/Dockerfile.barmanbase --platform linux/amd64 --platform linux/arm64
406+
publish --ref {{.BARMAN_BASE_IMAGE_NAME}} --tags "{{.BARMAN_VERSION}}-{{.BUILD_DATE}}"
380407
381408
controller-gen:
382409
desc: Run controller-gen

containers/Dockerfile.barmanbase

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.13-slim-bookworm
2+
COPY containers/sidecar-requirements.txt .
3+
RUN apt-get update && \
4+
apt-get install -y postgresql-common build-essential && \
5+
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
6+
apt-get install -y libpq-dev && \
7+
pip install -r sidecar-requirements.txt

0 commit comments

Comments
 (0)