Skip to content

Commit

Permalink
feat: handle multi-major version support
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Dec 9, 2024
1 parent 573df64 commit 82c4ca3
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 35 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ jobs:
run: |
MAJOR_VERSION="$(echo '${{ matrix.images.build.tag }}' | cut -d '.' -f 1)"
MINOR_VERSION="$(echo '${{ matrix.images.build.tag }}' | cut -d '.' -f 2)"
echo "IMAGE_TAGS=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:${{ matrix.images.build.tag }},${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:$MAJOR_VERSION.$MINOR_VERSION,${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:$MAJOR_VERSION,${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:latest" >> $GITHUB_OUTPUT
IMAGE_TAGS="${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:${{ matrix.images.build.tag }},${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:$MAJOR_VERSION.$MINOR_VERSION,${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:$MAJOR_VERSION"
if [[ "${{ matrix.images.build.latest}}" == "true" ]]; then
IMAGE_TAGS="$IMAGE_TAGS,${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.images.name}}:latest"
fi
echo "IMAGE_TAGS=$IMAGE_TAGS" >> $GITHUB_OUTPUT
- name: Checks-out repository
uses: actions/checkout@v4
Expand All @@ -101,3 +107,5 @@ jobs:
platforms: ${{ env.PLATFORMS }}
push: true
provenance: false
build-args: |
BASE_IMAGE="${{ matrix.images.build.base }}"
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@ Utility tools & scripts.

### Utils images

| Name | Description | Image name |
| ------------------------------------------------ | ----------------------------------------------------------------------- | ----------------------------------------- |
| [act-runner](./docker/act-runner/Dockerfile) | *act runner image for local CI tests (ubuntu based).* | `ghcr.io/this-is-tobi/tools/act-runner` |
| [debug](./docker/debug/Dockerfile) | *debug image with all convenients tools (debian based).* | `ghcr.io/this-is-tobi/tools/debug` |
| [dev](./docker/dev/Dockerfile) | *development image with all convenients tools (debian based).* | `ghcr.io/this-is-tobi/tools/dev` |
| [pg-backup](./docker/pg-backup/Dockerfile) | *helper image to backup postgresql to s3 (postgres based).* | `ghcr.io/this-is-tobi/tools/pg-backup` |
| [s3-backup](./docker/s3-backup/Dockerfile) | *helper image to backup s3 bucket to another s3 bucket (debian based).* | `ghcr.io/this-is-tobi/tools/s3-backup` |
| [vault-backup](./docker/vault-backup/Dockerfile) | *helper image to backup vault raft cluster to s3 bucket (vault based).* | `ghcr.io/this-is-tobi/tools/vault-backup` |

__Backup images correlation table :__

| Name | Image version | Tool version |
| ------------ | ------------- | ------------------- |
| pg-backup | 1.4.3 | *postgresql -* 15.7 |
| pg-backup | 2.0.0 | *postgresql -* 16.4 |
| pg-backup | 3.0.0 | *postgresql -* 17.0 |
| vault-backup | 1.1.3 | *vault -* 1.17.2 |
| vault-backup | 1.2.0 | *vault -* 1.18.0 |
| Image | Description | Dockerfiles |
| --------------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------- |
| ghcr.io/this-is-tobi/tools/act-runner | *act runner image for local CI tests (ubuntu based).* | [Dockerfile](./docker/act-runner/Dockerfile) |
| ghcr.io/this-is-tobi/tools/debug | *debug image with all convenients tools (debian based).* | [Dockerfile](./docker/debug/Dockerfile) |
| ghcr.io/this-is-tobi/tools/dev | *development image with all convenients tools (debian based).* | [Dockerfile](./docker/dev/Dockerfile) |
| ghcr.io/this-is-tobi/tools/pg-backup | *helper image to backup postgresql to s3 (postgres based).* | [Dockerfile](./docker/pg-backup/Dockerfile) |
| ghcr.io/this-is-tobi/tools/s3-backup | *helper image to backup s3 bucket to another s3 bucket (debian based).* | [Dockerfile](./docker/s3-backup/Dockerfile) |
| ghcr.io/this-is-tobi/tools/vault-backup | *helper image to backup vault raft cluster to s3 bucket (vault based).* | [Dockerfile](./docker/vault-backup/Dockerfile) |

__Versions correlation table :__

| Name | Image version | Base image |
| ------------ | ------------- | ---------------------------------- |
| act-runner | 2.0.1 | `docker.io/ubuntu:24.04` |
| debug | 2.0.0 | `docker.io/debian:12` |
| dev | 2.0.0 | `docker.io/debian:12` |
| pg-backup | 3.0.1 | `docker.io/postgres:17.2` |
| pg-backup | 2.0.1 | `docker.io/postgresql:16.6` |
| pg-backup | 1.4.4 | `docker.io/postgresql:15.10` |
| s3-backup | 1.1.3 | `docker.io/debian:12` |
| vault-backup | 1.2.1 | `docker.io/hashicorp/vault:1.18.2` |

> [!TIP]
> The backup images are supplied with a sample kubernetes cronjob in their respective folders.
Expand Down
46 changes: 40 additions & 6 deletions ci/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,89 @@
{
"name": "act-runner",
"build": {
"base": "docker.io/ubuntu:24.04",
"context": "./docker/act-runner",
"dockerfile": "./docker/act-runner/Dockerfile",
"target": "build",
"tag": "2.0.1"
"tag": "2.0.1",
"latest": true
}
},
{
"name": "debug",
"build": {
"base": "docker.io/debian:12",
"context": "./docker/debug",
"dockerfile": "./docker/debug/Dockerfile",
"target": "build",
"tag": "2.0.0"
"tag": "2.0.0",
"latest": true
}
},
{
"name": "dev",
"build": {
"base": "docker.io/debian:12",
"context": "./docker/dev",
"dockerfile": "./docker/dev/Dockerfile",
"target": "build",
"tag": "2.0.0"
"tag": "2.0.0",
"latest": true
}
},
{
"name": "pg-backup",
"build": {
"base": "docker.io/postgres:15.10",
"context": "./docker/pg-backup",
"dockerfile": "./docker/pg-backup/Dockerfile",
"target": "build",
"tag": "3.0.0"
"tag": "1.4.4",
"latest": false
}
},
{
"name": "pg-backup",
"build": {
"base": "docker.io/postgres:16.6",
"context": "./docker/pg-backup",
"dockerfile": "./docker/pg-backup/Dockerfile",
"target": "build",
"tag": "2.0.1",
"latest": false
}
},
{
"name": "pg-backup",
"build": {
"base": "docker.io/postgres:17.2",
"context": "./docker/pg-backup",
"dockerfile": "./docker/pg-backup/Dockerfile",
"target": "build",
"tag": "3.0.1",
"latest": true
}
},
{
"name": "s3-backup",
"build": {
"base": "docker.io/debian:12",
"context": "./docker/s3-backup",
"dockerfile": "./docker/s3-backup/Dockerfile",
"target": "build",
"tag": "1.1.3"
"tag": "1.1.3",
"latest": true
}
},
{
"name": "vault-backup",
"build": {
"base": "docker.io/hashicorp/vault:1.18.2",
"context": "./docker/vault-backup",
"dockerfile": "./docker/vault-backup/Dockerfile",
"target": "build",
"tag": "1.2.0"
"tag": "1.2.1",
"latest": true
}
}
]
9 changes: 5 additions & 4 deletions docker/act-runner/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# FROM ubuntu-latest
FROM docker.io/ubuntu:24.04 AS build
ARG BASE_IMAGE="docker.io/ubuntu:24.04"

FROM ${BASE_IMAGE} AS build

# Set system env
ARG TARGETOS
Expand All @@ -20,8 +21,8 @@ RUN apt-get update && apt-get install -y \
libcurl3-gnutls \
libcurl4 \
libgbm-dev \
libgtk2.0-0 \
libgtk-3-0 \
libgtk2.0-0 \
libnotify-dev \
libnss3 \
libxss1 \
Expand All @@ -38,8 +39,8 @@ RUN apt-get update && apt-get install -y \
xauth \
xvfb \
xz-utils \
zstd \
zip \
zstd \
&& rm -rf /var/lib/apt/lists/*

# Install docker
Expand Down
4 changes: 3 additions & 1 deletion docker/debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM docker.io/debian:12 AS build
ARG BASE_IMAGE="docker.io/debian:12"

FROM ${BASE_IMAGE} AS build

# Set system env
ENV DEBIAN_FRONTEND=noninteractive
Expand Down
5 changes: 3 additions & 2 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# FROM ubuntu-latest
FROM docker.io/debian:12 AS build
ARG BASE_IMAGE="docker.io/debian:12"

FROM ${BASE_IMAGE} AS build

# Set system env
ENV DEBIAN_FRONTEND=noninteractive
Expand Down
4 changes: 3 additions & 1 deletion docker/pg-backup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM docker.io/postgres:17.0 AS build
ARG BASE_IMAGE="docker.io/postgres:17.2"

FROM ${BASE_IMAGE} AS build

ARG TARGETARCH
ARG USERNAME=postgres
Expand Down
4 changes: 3 additions & 1 deletion docker/s3-backup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM docker.io/debian:12 AS build
ARG BASE_IMAGE="docker.io/debian:12"

FROM ${BASE_IMAGE} AS build

ARG TARGETARCH
ARG USERNAME=debian
Expand Down
4 changes: 3 additions & 1 deletion docker/vault-backup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM docker.io/hashicorp/vault:1.18.0 AS build
ARG BASE_IMAGE="docker.io/hashicorp/vault:1.18.2"

FROM ${BASE_IMAGE} AS build

ARG TARGETARCH
ARG USERNAME=vault
Expand Down

0 comments on commit 82c4ca3

Please sign in to comment.