Skip to content

Commit 7411e7c

Browse files
jcrapuchettesclaude
andcommitted
Replace DockerHub deployment with GitHub Container Registry
- Update push.yml to build and push latest images on master - Builds pg15-latest, pg16-latest, pg17-latest - Only runs after all tests pass - Uses GitHub Actions cache for faster builds - Update ci.yaml to build and push release images on tags - Replaces Fly.io DockerHub workflow with GHCR - Creates multiple tags per release (major, full version, release tag) - Uses matrix strategy to build all PG versions in parallel Images are now pushed to ghcr.io instead of flyio/postgres-flex 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 78257df commit 7411e7c

2 files changed

Lines changed: 80 additions & 120 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 36 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -7,138 +7,54 @@ jobs:
77
release:
88
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
99
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
pg_version:
13+
- major: "15"
14+
full: "15.14"
15+
- major: "16"
16+
full: "16.10"
17+
- major: "17"
18+
full: "17.6"
1019

1120
steps:
12-
-
13-
name: Set up QEMU
14-
uses: docker/setup-qemu-action@v3
15-
-
16-
name: Set up Docker Buildx
17-
uses: docker/setup-buildx-action@v3
18-
with:
19-
version: v0.9.1
20-
-
21-
name: Login to DockerHub
22-
uses: docker/login-action@v3
23-
with:
24-
username: ${{ secrets.DOCKERHUB_USERNAME }}
25-
password: ${{ secrets.DOCKERHUB_TOKEN }}
2621
- uses: actions/checkout@v5
2722
with:
2823
fetch-depth: 0
29-
-
30-
name: "Fetch latest tag"
31-
id: get-latest-tag
32-
uses: "WyriHaximus/github-action-get-previous-tag@v1"
33-
-
34-
name: Build and push Postgres 15
35-
id: docker_build_15
36-
uses: docker/build-push-action@v6
37-
with:
38-
build-args: |
39-
PG_VERSION=15.14
40-
PG_MAJOR_VERSION=15
41-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
42-
context: .
43-
file: ./pg15/Dockerfile
44-
push: true
45-
tags: |
46-
flyio/postgres-flex:15
47-
flyio/postgres-flex:15.14
48-
-
49-
name: Build and push Postgres 15 Timescale DB
50-
id: docker_build_15_timescaledb
51-
uses: docker/build-push-action@v6
52-
with:
53-
build-args: |
54-
PG_VERSION=15.14
55-
PG_MAJOR_VERSION=15
56-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
57-
context: .
58-
file: ./pg15/Dockerfile-timescaledb
59-
push: true
60-
tags: |
61-
flyio/postgres-flex-timescaledb:15
62-
flyio/postgres-flex-timescaledb:15.14
6324

64-
-
65-
name: Build and push Postgres 16
66-
id: docker_build_16
67-
uses: docker/build-push-action@v6
68-
with:
69-
build-args: |
70-
PG_VERSION=16.10
71-
PG_MAJOR_VERSION=16
72-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
73-
context: .
74-
file: ./pg16/Dockerfile
75-
push: true
76-
tags: |
77-
flyio/postgres-flex:16
78-
flyio/postgres-flex:16.10
79-
-
80-
name: Build and push Postgres 16 Timescale DB
81-
id: docker_build_16_timescaledb
82-
uses: docker/build-push-action@v6
25+
- name: Get tag name
26+
id: tag
27+
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Log in to GitHub Container Registry
36+
uses: docker/login-action@v3
8337
with:
84-
build-args: |
85-
PG_VERSION=16.10
86-
PG_MAJOR_VERSION=16
87-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
88-
context: .
89-
file: ./pg16/Dockerfile-timescaledb
90-
push: true
91-
tags: |
92-
flyio/postgres-flex-timescaledb:16
93-
flyio/postgres-flex-timescaledb:16.10
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
9441

95-
-
96-
name: Build and push Postgres 17
97-
id: docker_build_17
42+
- name: Build and push release
9843
uses: docker/build-push-action@v6
9944
with:
100-
build-args: |
101-
PG_VERSION=17.6
102-
PG_MAJOR_VERSION=17
103-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
10445
context: .
105-
file: ./pg17/Dockerfile
46+
file: ./pg${{ matrix.pg_version.major }}/Dockerfile
10647
push: true
10748
tags: |
108-
flyio/postgres-flex:17
109-
flyio/postgres-flex:17.6
110-
-
111-
name: Build and push Postgres 17 Timescale DB
112-
id: docker_build_17_timescaledb
113-
uses: docker/build-push-action@v6
114-
with:
49+
ghcr.io/${{ github.repository }}/postgres-flex:${{ matrix.pg_version.major }}
50+
ghcr.io/${{ github.repository }}/postgres-flex:${{ matrix.pg_version.full }}
51+
ghcr.io/${{ github.repository }}/postgres-flex:${{ steps.tag.outputs.TAG }}-${{ matrix.pg_version.major }}
11552
build-args: |
116-
PG_VERSION=17.6
117-
PG_MAJOR_VERSION=17
118-
VERSION=${{ steps.get-latest-tag.outputs.tag }}
119-
context: .
120-
file: ./pg17/Dockerfile-timescaledb
121-
push: true
122-
tags: |
123-
flyio/postgres-flex-timescaledb:17
124-
flyio/postgres-flex-timescaledb:17.6
125-
53+
PG_VERSION=${{ matrix.pg_version.full }}
54+
PG_MAJOR_VERSION=${{ matrix.pg_version.major }}
55+
VERSION=${{ steps.tag.outputs.TAG }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
12658

127-
-
128-
name: Postgres 15 Image digest
129-
run: echo ${{ steps.docker_build_15.outputs.digest }}
130-
-
131-
name: Postgres 15 TimescaleDB Image digest
132-
run: echo ${{ steps.docker_build_15_timescaledb.outputs.digest }}
133-
-
134-
name: Postgres 16 Image digest
135-
run: echo ${{ steps.docker_build_16.outputs.digest }}
136-
-
137-
name: Postgres 16 TimescaleDB Image digest
138-
run: echo ${{ steps.docker_build_16_timescaledb.outputs.digest }}
139-
-
140-
name: Postgres 17 Image digest
141-
run: echo ${{ steps.docker_build_17.outputs.digest }}
142-
-
143-
name: Postgres 17 TimescaleDB Image digest
144-
run: echo ${{ steps.docker_build_17_timescaledb.outputs.digest }}
59+
- name: Image digest
60+
run: echo "Built ${{ matrix.pg_version.major }} for release ${{ steps.tag.outputs.TAG }}"

.github/workflows/push.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,47 @@ jobs:
7474

7575
- run: go install github.com/kisielk/errcheck@latest
7676
- run: errcheck -ignore 'AddCheck' ./...
77+
78+
docker:
79+
name: "Build Docker Images"
80+
runs-on: ubuntu-latest
81+
needs: [build, unit, staticcheck, errcheck]
82+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
83+
strategy:
84+
matrix:
85+
pg_version:
86+
- major: "15"
87+
full: "15.14"
88+
- major: "16"
89+
full: "16.10"
90+
- major: "17"
91+
full: "17.6"
92+
steps:
93+
- uses: actions/checkout@v5
94+
95+
- name: Set up QEMU
96+
uses: docker/setup-qemu-action@v3
97+
98+
- name: Set up Docker Buildx
99+
uses: docker/setup-buildx-action@v3
100+
101+
- name: Log in to GitHub Container Registry
102+
uses: docker/login-action@v3
103+
with:
104+
registry: ghcr.io
105+
username: ${{ github.actor }}
106+
password: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- name: Build and push latest
109+
uses: docker/build-push-action@v6
110+
with:
111+
context: .
112+
file: ./pg${{ matrix.pg_version.major }}/Dockerfile
113+
push: true
114+
tags: ghcr.io/${{ github.repository }}/postgres-flex:${{ matrix.pg_version.major }}-latest
115+
build-args: |
116+
PG_VERSION=${{ matrix.pg_version.full }}
117+
PG_MAJOR_VERSION=${{ matrix.pg_version.major }}
118+
VERSION=latest-${{ github.sha }}
119+
cache-from: type=gha
120+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)