Skip to content

Commit c21c81c

Browse files
Add postgres 17 and add backup utils
1 parent e9ac4f3 commit c21c81c

File tree

5 files changed

+110
-7
lines changed

5 files changed

+110
-7
lines changed

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu, alpine]
15-
postgres_version: [12, 13, 14, 15, 16]
15+
postgres_version: [12, 13, 14, 15, 16, 17]
1616
exclude:
1717
- os: alpine
1818
postgres_version: 12

Dockerfile.alpine

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
FROM alpine:latest
22

33
ARG POSTGRES_VERSION=15
4+
ARG TARGETARCH
45

5-
RUN apk update && apk add postgresql${POSTGRES_VERSION}-client
6+
RUN apk update && apk add zip gzip xz curl wget rsync openssl gpg ca-certificates lsb-release postgresql${POSTGRES_VERSION}-client
7+
8+
# Install rclone
9+
RUN curl -sSL https://downloads.rclone.org/rclone-current-linux-$TARGETARCH.zip -o rclone.zip && \
10+
unzip rclone.zip && \
11+
install -Dm755 rclone-*-linux-$TARGETARCH/rclone /usr/bin/rclone && \
12+
rm -rf rclone.zip rclone-*-linux-$TARGETARCH

Dockerfile.ubuntu

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
FROM ubuntu:latest AS base
22

33
ARG POSTGRES_VERSION=15
4+
ARG TARGETARCH
45

6+
# Install common utils and add PostgreSQL repository
57
RUN apt-get -y update && \
6-
apt-get -y install curl ca-certificates lsb-release && \
8+
apt-get -y install zip gzip xz-utils curl wget rsync openssl gpg ca-certificates lsb-release && \
79
install -d /usr/share/postgresql-common/pgdg && \
810
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc && \
9-
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
10-
apt-get -y update
11+
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
1112

12-
RUN apt-get -y install postgresql-client-$POSTGRES_VERSION
13+
# Install rclone
14+
RUN curl -sSL https://downloads.rclone.org/rclone-current-linux-$TARGETARCH.zip -o rclone.zip && \
15+
unzip rclone.zip && \
16+
install -Dm755 rclone-*-linux-$TARGETARCH/rclone /usr/bin/rclone && \
17+
rm -rf rclone.zip rclone-*-linux-$TARGETARCH
18+
19+
RUN apt-get -y update && apt-get -y install postgresql-client-$POSTGRES_VERSION

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ A Docker image for all of the PostgreSQL client executables, including:
1313
- `pg_verifybackup` - Verify the integrity of a base backup of a PostgreSQL cluster
1414
- [And many more...](https://www.postgresql.org/docs/current/reference-client.html)
1515

16+
The image also includes common file transfer utilities to allow use of this image for backup and restore operations, including:
17+
18+
- `curl`, `wget` - Download files from the internet
19+
- `tar`, `gzip`, `zip` and `xz` - Archive and compress files
20+
- `openssl` and `gpg` - Encrypt and decrypt files
21+
- `rsync` - Synchronize files and directories between two locations
22+
- `rclone` - https://rclone.org/ - Sync files and directories to and from cloud storage providers
23+
1624
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:
1725

26+
- 17
1827
- 16
1928
- 15
20-
- 14
29+
- 14 (Ubuntu only)
2130
- 13 (Ubuntu only)
2231
- 12 (Ubuntu only)
2332

build_all_images.ps1

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
$oses = @("ubuntu", "alpine")
2+
$postgresVersions = @(12, 13, 14, 15, 16, 17)
3+
$exclusions = @(
4+
@{ os = "alpine"; postgres_version = 12 },
5+
@{ os = "alpine"; postgres_version = 13 },
6+
@{ os = "alpine"; postgres_version = 14 }
7+
)
8+
9+
$successfulBuilds = @()
10+
$failedBuilds = @()
11+
12+
foreach ($os in $oses) {
13+
foreach ($version in $postgresVersions) {
14+
$isExcluded = $false
15+
foreach ($exclusion in $exclusions) {
16+
if ($exclusion.os -eq $os -and $exclusion.postgres_version -eq $version) {
17+
$isExcluded = $true
18+
break
19+
}
20+
}
21+
22+
if ($isExcluded) {
23+
Write-Host "Skipping excluded combination: OS=$os, PostgreSQL=$version"
24+
continue
25+
}
26+
27+
$tags = @("binaryoverload/postgresql-client:$version-$os")
28+
if ($os -eq "ubuntu") {
29+
$tags += "binaryoverload/postgresql-client:$version"
30+
}
31+
32+
Write-Host ""
33+
Write-Host "───────────────────────────────────────────────"
34+
Write-Host "Building image for OS=$os, PostgreSQL=$version"
35+
Write-Host "Tags: $($tags -join ', ')"
36+
Write-Host "───────────────────────────────────────────────"
37+
38+
$tagArgs = $tags | ForEach-Object { "--tag=$_" }
39+
40+
$buildArgs = @(
41+
"buildx", "build",
42+
"--file", "./Dockerfile.$os",
43+
"--build-arg", "POSTGRES_VERSION=$version"
44+
) + $tagArgs + "."
45+
46+
Write-Host "Running Docker command:"
47+
Write-Host "docker $($buildArgs -join ' ')"
48+
49+
docker @buildArgs
50+
51+
if ($LASTEXITCODE -ne 0) {
52+
Write-Warning "Build failed for OS=$os, PostgreSQL=$version"
53+
$failedBuilds += "$os/$version"
54+
}
55+
else {
56+
$successfulBuilds += "$os/$version"
57+
}
58+
59+
Write-Host ""
60+
}
61+
}
62+
63+
# Summary report
64+
Write-Host "`n=================== Build Summary ==================="
65+
Write-Host "✅ Successful builds:"
66+
if ($successfulBuilds.Count -eq 0) {
67+
Write-Host " (none)"
68+
}
69+
else {
70+
$successfulBuilds | ForEach-Object { Write-Host " $_" }
71+
}
72+
73+
Write-Host "`n❌ Failed builds:"
74+
if ($failedBuilds.Count -eq 0) {
75+
Write-Host " (none)"
76+
}
77+
else {
78+
$failedBuilds | ForEach-Object { Write-Host " $_" }
79+
}
80+
Write-Host "======================================================`n"

0 commit comments

Comments
 (0)