Skip to content

Commit 6c8d9c5

Browse files
committed
Sync build base and prod images
1 parent 8483dfd commit 6c8d9c5

4 files changed

Lines changed: 84 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ jobs:
143143
# Combinations used to build assets
144144
# Usually only a single variant
145145
assets-matrix: ${{ steps.assets-matrix.outputs.result }}
146+
# Combinations to sync images to GHCR for
147+
sync-matrix: ${{ steps.common-matrix.outputs.result }}
146148

147149
# Select environment to deploy to based on git branch/tag
148150
environment: ${{ (github.ref_name == 'main' && 'staging') || (github.ref_name == 'prod' && 'production') }}
@@ -183,7 +185,7 @@ jobs:
183185
# https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
184186
github-advanced-security: '0'
185187

186-
# Create a GitHub release for this build
188+
# Create GitHub release for this build
187189
create-release: '0'
188190
steps:
189191
- name: Configure common-matrix
@@ -212,9 +214,9 @@ jobs:
212214
{
213215
os: "debian",
214216
elixir: "1.19.5",
215-
otp: "28.4.1",
216-
build_os_ver: "trixie-20260316-slim",
217-
prod_os_ver: "trixie-20260316-slim"
217+
otp: "28.4.2",
218+
build_os_ver: "trixie-20260406-slim",
219+
prod_os_ver: "trixie-20260406-slim"
218220
},
219221
]
220222
}
@@ -228,9 +230,9 @@ jobs:
228230
{
229231
os: "debian",
230232
elixir: "1.19.5",
231-
otp: "28.4.1",
232-
build_os_ver: "trixie-20260316-slim",
233-
prod_os_ver: "trixie-20260316-slim"
233+
otp: "28.4.2",
234+
build_os_ver: "trixie-20260406-slim",
235+
prod_os_ver: "trixie-20260406-slim"
234236
},
235237
]
236238
let ci_nodes = [1, 2]
@@ -269,9 +271,9 @@ jobs:
269271
{
270272
os: "debian",
271273
elixir: "1.19.5",
272-
otp: "28.4.1",
273-
build_os_ver: "trixie-20260316-slim",
274-
prod_os_ver: "trixie-20260316-slim"
274+
otp: "28.4.2",
275+
build_os_ver: "trixie-20260406-slim",
276+
prod_os_ver: "trixie-20260406-slim"
275277
},
276278
]
277279
}
@@ -286,9 +288,9 @@ jobs:
286288
{
287289
os: "debian",
288290
elixir: "1.19.5",
289-
otp: "28.4.1",
290-
build_os_ver: "trixie-20260316-slim",
291-
prod_os_ver: "trixie-20260316-slim"
291+
otp: "28.4.2",
292+
build_os_ver: "trixie-20260406-slim",
293+
prod_os_ver: "trixie-20260406-slim"
292294
},
293295
]
294296
}
@@ -303,9 +305,9 @@ jobs:
303305
{
304306
os: "debian",
305307
elixir: "1.19.5",
306-
otp: "28.4.1",
307-
build_os_ver: "trixie-20260316-slim",
308-
prod_os_ver: "trixie-20260316-slim"
308+
otp: "28.4.2",
309+
build_os_ver: "trixie-20260406-slim",
310+
prod_os_ver: "trixie-20260406-slim"
309311
},
310312
]
311313
}
@@ -1833,6 +1835,53 @@ jobs:
18331835
# --s3-location "bucket=${CODEDEPLOY_BUCKET},key=${REVISION_FILE},bundleType=zip" \
18341836
# --description "App ${RELEASE_TAG} ${RELEASE_TIMESTAMP} ${GITHUB_SHA_SHORT}"
18351837

1838+
# Copy Elixir images to GHCR
1839+
# Avoids rate limits and speeds up pull performance
1840+
sync-images-elixir:
1841+
name: Sync Elixir base images
1842+
needs: [config]
1843+
if: needs.config.outputs.sync-images == '1'
1844+
permissions:
1845+
id-token: write
1846+
contents: read
1847+
packages: write
1848+
runs-on: ubuntu-latest
1849+
environment: ${{ needs.config.outputs.environment }}
1850+
strategy:
1851+
fail-fast: false
1852+
matrix: ${{ fromJson(needs.config.outputs.sync-matrix) }}
1853+
env:
1854+
ELIXIR_BASE_TAG: ${{ matrix.elixir }}-erlang-${{ matrix.otp }}-${{ matrix.os }}-${{ matrix.build_os_ver }}
1855+
MATRIX_OS: ${{ matrix.os }}
1856+
MATRIX_PROD_OS_VER: ${{ matrix.prod_os_ver }}
1857+
steps:
1858+
- name: Log in to GHCR
1859+
uses: docker/login-action@v4
1860+
with:
1861+
registry: ghcr.io
1862+
username: ${{ github.actor }}
1863+
password: ${{ secrets.GITHUB_TOKEN }}
1864+
1865+
# Pull public images without rate limits
1866+
- name: Log in to Docker Hub
1867+
uses: docker/login-action@v4
1868+
with:
1869+
username: ${{ secrets.DOCKERHUB_USERNAME }}
1870+
password: ${{ secrets.DOCKERHUB_TOKEN }}
1871+
1872+
- name: Check out source
1873+
uses: actions/checkout@v6
1874+
1875+
# https://github.com/regclient/actions
1876+
- name: Install regsync
1877+
uses: regclient/actions/regsync-installer@v0.1.0
1878+
with:
1879+
release: 'v0.11.1' # optional version
1880+
1881+
- name: Sync Elxir and OS base images to GHCR
1882+
run: regsync once -c deploy/regsync-ghcr-matrix.yml
1883+
1884+
18361885
# Copy 3rd-party images to GHCR and ECR
18371886
# Avoids rate limits and speeds up pull performance
18381887
sync-images:

deploy/regsync-ghcr-matrix.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This syncs base images controlled by build matrix
2+
sync:
3+
# Build base image
4+
- source: docker.io/hexpm/elixir:{{ env "ELIXIR_BASE_TAG" }}
5+
target: ghcr.io/cogini/elixir:{{ env "ELIXIR_BASE_TAG" }}
6+
type: image
7+
# Deploy base image
8+
- source: docker.io/{{ env "MATRIX_OS }:{{ env "MATRIX_PROD_OS_VER" }}
9+
target: ghcr.io/cogini/{{ env "MATRIX_OS" }}:{{ env "MATRIX_PROD_OS_VER"}}
10+
type: image

deploy/regsync-ghcr.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# https://regclient.org/usage/regsync/
22
sync:
33
# Build base image
4-
- source: docker.io/hexpm/elixir:1.19.5-erlang-28.4.1-debian-trixie-20260316-slim
5-
- source: ghcr.io/cogini/elixir:1.19.5-erlang-28.4.1-debian-trixie-20260316-slim
6-
type: image
4+
# - source: docker.io/hexpm/elixir:1.19.5-erlang-28.4.2-debian-trixie-20260406-slim
5+
# target: ghcr.io/cogini/elixir:1.19.5-erlang-28.4.2-debian-trixie-20260406-slim
6+
# type: image
77
# Build aws-otel-collector base image
88
- source: docker.io/amazon/aws-otel-collector:latest
99
target: ghcr.io/cogini/aws-otel-collector:latest
@@ -12,12 +12,12 @@ sync:
1212
target: ghcr.io/cogini/aws-otel-collector:v0.47.0
1313
type: image
1414
# Deploy base image
15-
- source: docker.io/debian:trixie-slim
16-
target: ghcr.io/cogini/debian:trixie-slim
17-
type: image
18-
- source: docker.io/debian:trixie-20260316-slim
19-
target: ghcr.io/cogini/debian:trixie-20260316-slim
20-
type: image
15+
# - source: docker.io/debian:trixie-slim
16+
# target: ghcr.io/cogini/debian:trixie-slim
17+
# type: image
18+
# - source: docker.io/debian:trixie-20260406-slim
19+
# target: ghcr.io/cogini/debian:trixie-20260406-slim
20+
# type: image
2121
# Test deps
2222
# https://hub.docker.com/_/postgres
2323
- source: docker.io/postgres:latest

0 commit comments

Comments
 (0)