Skip to content

Commit 397056e

Browse files
Add mariadb and generic backup image
1 parent a4d769f commit 397056e

17 files changed

+415
-43
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
name: Publish Docker image
1+
name: Publish Backup Docker images
22

33
on:
44
workflow_dispatch:
55
push:
66
branches: ["main"]
77

88
jobs:
9-
push_to_registry:
10-
name: Publish Image
9+
publish_backup:
10+
name: Publish Backup Images
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
1414
os: [ubuntu, alpine]
15-
postgres_version: [12, 13, 14, 15, 16, 17]
16-
exclude:
17-
- os: alpine
18-
postgres_version: 12
19-
- os: alpine
20-
postgres_version: 13
21-
- os: alpine
22-
postgres_version: 14
15+
2316
steps:
2417
- name: Check out the repo
2518
uses: actions/checkout@v4
@@ -34,24 +27,22 @@ jobs:
3427
id: meta
3528
uses: docker/metadata-action@v5
3629
with:
37-
images: binaryoverload/postgresql-client
30+
images: binaryoverload/backup-client
3831
tags: |
39-
type=raw,value=${{ matrix.postgres_version }},enable=${{ matrix.os == 'ubuntu' }}
40-
type=raw,value=${{ matrix.postgres_version }}-${{ matrix.os }}
32+
type=raw,value=latest,enable=${{ matrix.os == 'ubuntu' }}
33+
type=raw,value=${{ matrix.os }}
4134
4235
- name: Set up Docker Buildx
4336
uses: docker/setup-buildx-action@v3
4437

4538
- name: Build and push Docker image
4639
uses: docker/build-push-action@v5
4740
with:
48-
context: .
41+
context: ./backup
4942
platforms: linux/amd64,linux/arm64
50-
file: ./Dockerfile.${{ matrix.os }}
43+
file: ./backup/Dockerfile.${{ matrix.os }}
5144
push: true
5245
tags: ${{ steps.meta.outputs.tags }}
5346
labels: ${{ steps.meta.outputs.labels }}
54-
build-args: |
55-
POSTGRES_VERSION=${{ matrix.postgres_version }}
5647
cache-from: type=gha
5748
cache-to: type=gha,mode=max
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish MariaDB Docker images
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ["main"]
7+
8+
jobs:
9+
publish_mariadb:
10+
name: Publish MariaDB Images
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
os: [ubuntu, alpine]
15+
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@v4
19+
20+
- name: Log in to Docker Hub
21+
uses: docker/login-action@v3
22+
with:
23+
username: ${{ secrets.DOCKER_USERNAME }}
24+
password: ${{ secrets.DOCKER_PASSWORD }}
25+
26+
- name: Extract metadata (tags, labels) for Docker
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: binaryoverload/mariadb-client
31+
tags: |
32+
type=raw,value=latest,enable=${{ matrix.os == 'ubuntu' }}
33+
type=raw,value=${{ matrix.os }}
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: ./mariadb
42+
platforms: linux/amd64,linux/arm64
43+
file: ./mariadb/Dockerfile.${{ matrix.os }}
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
cache-from: type=gha
48+
cache-to: type=gha,mode=max
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish Postgres Docker images
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ["main"]
7+
8+
jobs:
9+
publish_postgres:
10+
name: Publish Postgres Images
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
os: [ubuntu, alpine]
15+
postgres_version: [12, 13, 14, 15, 16, 17]
16+
exclude:
17+
- os: alpine
18+
postgres_version: 12
19+
- os: alpine
20+
postgres_version: 13
21+
- os: alpine
22+
postgres_version: 14
23+
24+
steps:
25+
- name: Check out the repo
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to Docker Hub
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ secrets.DOCKER_USERNAME }}
32+
password: ${{ secrets.DOCKER_PASSWORD }}
33+
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: binaryoverload/postgresql-client
39+
tags: |
40+
type=raw,value=${{ matrix.postgres_version }},enable=${{ matrix.os == 'ubuntu' }}
41+
type=raw,value=${{ matrix.postgres_version }}-${{ matrix.os }}
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: ./postgres
50+
platforms: linux/amd64,linux/arm64
51+
file: ./postgres/Dockerfile.${{ matrix.os }}
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}
55+
build-args: |
56+
POSTGRES_VERSION=${{ matrix.postgres_version }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
60+
publish_mariadb:
61+
name: Publish MariaDB Images
62+
runs-on: ubuntu-latest
63+
strategy:
64+
matrix:
65+
os: [ubuntu, alpine]
66+
67+
steps:
68+
- name: Check out the repo
69+
uses: actions/checkout@v4
70+
71+
- name: Log in to Docker Hub
72+
uses: docker/login-action@v3
73+
with:
74+
username: ${{ secrets.DOCKER_USERNAME }}
75+
password: ${{ secrets.DOCKER_PASSWORD }}
76+
77+
- name: Extract metadata (tags, labels) for Docker
78+
id: meta
79+
uses: docker/metadata-action@v5
80+
with:
81+
images: binaryoverload/mariadb-client
82+
tags: |
83+
type=raw,value=latest,enable=${{ matrix.os == 'ubuntu' }}
84+
type=raw,value=${{ matrix.os }}
85+
86+
- name: Set up Docker Buildx
87+
uses: docker/setup-buildx-action@v3
88+
89+
- name: Build and push Docker image
90+
uses: docker/build-push-action@v5
91+
with:
92+
context: ./mariadb
93+
platforms: linux/amd64,linux/arm64
94+
file: ./mariadb/Dockerfile.${{ matrix.os }}
95+
push: true
96+
tags: ${{ steps.meta.outputs.tags }}
97+
labels: ${{ steps.meta.outputs.labels }}
98+
cache-from: type=gha
99+
cache-to: type=gha,mode=max

.github/workflows/dockerhub-description.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,22 @@ on:
77
paths:
88
- README.md
99
- .github/workflows/dockerhub-description.yml
10+
1011
jobs:
1112
dockerHubDescription:
1213
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
package: [postgresql-client, mariadb-client]
17+
include:
18+
- package: postgresql-client
19+
description: A PostgreSQL client image with built-in file transfer and backup tools.
20+
readme: ./postgres/README.md
21+
22+
- package: mariadb-client
23+
description: A MariaDB client image with built-in file transfer and backup tools.
24+
readme: ./mariadb/README.md
25+
1326
steps:
1427
- uses: actions/checkout@v4
1528

@@ -18,6 +31,7 @@ jobs:
1831
with:
1932
username: ${{ secrets.DOCKER_USERNAME }}
2033
password: ${{ secrets.DOCKER_PASSWORD }}
21-
repository: binaryoverload/postgresql-client
22-
short-description: ${{ github.event.repository.description }}
34+
repository: binaryoverload/${{ matrix.package }}
35+
short-description: ${{ matrix.description }}
36+
readme-filepath: ${{ matrix.readme }}
2337
enable-url-completion: true

README.md

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
1-
# binaryoverload/postgresql-client
1+
# Backup Clients
22

3-
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/binaryoverload/docker-postgresql-client/docker.yml) [![Docker Hub](https://img.shields.io/badge/Docker%20Hub-gray?logo=docker)](https://hub.docker.com/r/binaryoverload/postgresql-client) [![GitHub](https://img.shields.io/badge/GitHub-black?logo=github&logoColor=white)](https://github.com/binaryoverload/docker-postgresql-client/)
3+
This repo contains Docker images for with backup and restore utilities for the following databases:
44

5-
A Docker image for all of the PostgreSQL client executables, including:
5+
- [PostgreSQL](./postgres)
6+
- [MariaDB](./mariadb) (aka MySQL)
7+
- MongoDB (coming soon)
68

7-
- `pg_dump` - Extract a PostgreSQL database into a script file or other archive file
8-
- `pg_dumpall` - Extract a PostgreSQL database cluster into a script file
9-
- `pg_restore` - Restore a PostgreSQL database from an archive file created by pg_dump
10-
- `psql` - PostgreSQL interactive terminal
11-
- `pg_isready` - Check the connection status of a PostgreSQL server
12-
- `pg_basebackup` - Take a base backup of a PostgreSQL cluster
13-
- `pg_verifybackup` - Verify the integrity of a base backup of a PostgreSQL cluster
14-
- [And many more...](https://www.postgresql.org/docs/current/reference-client.html)
9+
It also contains an image without any database client, but with the same utilities.
1510

16-
The image also includes common file transfer utilities to allow use of this image for backup and restore operations, including:
11+
These images are designed to be used as base images for running backup and restore scripts, and are deployed in both Ubuntu (Default) and Alpine distro variants with all major supported versions of the database clients.
12+
13+
The primary motivation for creating these images was having an image that could be used in Kubernetes jobs to run backup and restore scripts.
14+
15+
Each image contains the following utilities along with the database client:
1716

1817
- `curl`, `wget` - Download files from the internet
1918
- `tar`, `gzip`, `zip` and `xz` - Archive and compress files
2019
- `openssl` and `gpg` - Encrypt and decrypt files
2120
- `rsync` - Synchronize files and directories between two locations
2221
- `rclone` - https://rclone.org/ - Sync files and directories to and from cloud storage providers
23-
24-
This image is intended to be used as a base image for running PostgreSQL scripts and as such is deployed in both Ubuntu (Default) and Alpine distro variants with all major supported versions:
25-
26-
- 17
27-
- 16
28-
- 15
29-
- 14 (Ubuntu only)
30-
- 13 (Ubuntu only)
31-
- 12 (Ubuntu only)
32-
33-
Information on the versions of PostgreSQL and their support periods can be found [at the link here](https://www.postgresql.org/support/versioning/).

backup/Dockerfile.alpine

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM alpine:latest
2+
3+
ARG TARGETARCH
4+
5+
RUN apk update && apk add zip gzip xz curl wget rsync openssl gpg ca-certificates lsb-release
6+
7+
# Install rclone
8+
RUN curl -sSL https://downloads.rclone.org/rclone-current-linux-$TARGETARCH.zip -o rclone.zip && \
9+
unzip rclone.zip && \
10+
install -Dm755 rclone-*-linux-$TARGETARCH/rclone /usr/bin/rclone && \
11+
rm -rf rclone.zip rclone-*-linux-$TARGETARCH

backup/Dockerfile.ubuntu

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:latest AS base
2+
3+
ARG TARGETARCH
4+
5+
# Install common utils
6+
RUN apt-get -y update && \
7+
apt-get -y install zip gzip xz-utils curl wget rsync openssl gpg ca-certificates lsb-release
8+
9+
# Install rclone
10+
RUN curl -sSL https://downloads.rclone.org/rclone-current-linux-$TARGETARCH.zip -o rclone.zip && \
11+
unzip rclone.zip && \
12+
install -Dm755 rclone-*-linux-$TARGETARCH/rclone /usr/bin/rclone && \
13+
rm -rf rclone.zip rclone-*-linux-$TARGETARCH

backup/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# binaryoverload/backup-client
2+
3+
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/binaryoverload/docker-backup-clients/docker-backup.yml) [![Docker Hub](https://img.shields.io/badge/Docker%20Hub-gray?logo=docker)](https://hub.docker.com/r/binaryoverload/backup-client) [![GitHub](https://img.shields.io/badge/GitHub-black?logo=github&logoColor=white)](https://github.com/binaryoverload/docker-backup-clients/)
4+
5+
A Docker image containing common backup and file transfer utilities for use in backup and restore operations, including:
6+
7+
- `curl`, `wget` - Download files from the internet
8+
- `tar`, `gzip`, `zip` and `xz` - Archive and compress files
9+
- `openssl` and `gpg` - Encrypt and decrypt files
10+
- `rsync` - Synchronize files and directories between two locations
11+
- `rclone` - https://rclone.org/ - Sync files and directories to and from cloud storage providers
12+
13+
This image is intended to be used as a base image for running scripts and as such is deployed in both Ubuntu (Default) and Alpine distro variants.

backup/build_all_images.ps1

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
$oses = @("ubuntu", "alpine")
2+
3+
$successfulBuilds = @()
4+
$failedBuilds = @()
5+
6+
foreach ($os in $oses) {
7+
$tags = @("binaryoverload/backup-client:$os")
8+
if ($os -eq "ubuntu") {
9+
$tags += "binaryoverload/backup-client:latest"
10+
}
11+
12+
Write-Host ""
13+
Write-Host "───────────────────────────────────────────────"
14+
Write-Host "Building image for OS=$os"
15+
Write-Host "Tags: $($tags -join ', ')"
16+
Write-Host "───────────────────────────────────────────────"
17+
18+
$tagArgs = $tags | ForEach-Object { "--tag=$_" }
19+
20+
$buildArgs = @(
21+
"buildx", "build",
22+
"--file", "./Dockerfile.$os"
23+
) + $tagArgs + "."
24+
25+
Write-Host "Running Docker command:"
26+
Write-Host "docker $($buildArgs -join ' ')"
27+
28+
docker @buildArgs
29+
30+
if ($LASTEXITCODE -ne 0) {
31+
Write-Warning "Build failed for OS=$os"
32+
$failedBuilds += "$os"
33+
}
34+
else {
35+
$successfulBuilds += "$os"
36+
}
37+
38+
Write-Host ""
39+
}
40+
41+
# Summary report
42+
Write-Host "`n=================== Build Summary ==================="
43+
Write-Host "✅ Successful builds:"
44+
if ($successfulBuilds.Count -eq 0) {
45+
Write-Host " (none)"
46+
}
47+
else {
48+
$successfulBuilds | ForEach-Object { Write-Host " $_" }
49+
}
50+
51+
Write-Host "`n❌ Failed builds:"
52+
if ($failedBuilds.Count -eq 0) {
53+
Write-Host " (none)"
54+
}
55+
else {
56+
$failedBuilds | ForEach-Object { Write-Host " $_" }
57+
}
58+
Write-Host "======================================================`n"

mariadb/Dockerfile.alpine

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM alpine:latest
2+
3+
ARG TARGETARCH
4+
5+
RUN apk update && apk add zip gzip xz curl wget rsync openssl gpg ca-certificates lsb-release mariadb-client
6+
7+
# Install rclone
8+
RUN curl -sSL https://downloads.rclone.org/rclone-current-linux-$TARGETARCH.zip -o rclone.zip && \
9+
unzip rclone.zip && \
10+
install -Dm755 rclone-*-linux-$TARGETARCH/rclone /usr/bin/rclone && \
11+
rm -rf rclone.zip rclone-*-linux-$TARGETARCH

0 commit comments

Comments
 (0)