Skip to content

Commit 5323954

Browse files
Copilotalessfg
andcommitted
Implement local registry image sharing for Alpine mainline PR builds
Co-authored-by: alessfg <[email protected]>
1 parent 9517e9b commit 5323954

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

.github/workflows/alpine-mainline.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ jobs:
3737
runs-on: ubuntu-24.04
3838
strategy:
3939
fail-fast: false
40+
services:
41+
registry:
42+
image: registry:2
43+
ports:
44+
- 5000:5000
4045
steps:
4146
- name: Check out the codebase
4247
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -93,6 +98,7 @@ jobs:
9398
ghcr.io/nginx/nginx-unprivileged
9499
public.ecr.aws/nginx/nginx-unprivileged
95100
quay.io/nginx/nginx-unprivileged
101+
${{ github.event_name == 'pull_request' && 'localhost:5000/nginx-unprivileged' || '' }}
96102
tags: |
97103
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine-slim
98104
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine${{ needs.version.outputs.distro }}-slim
@@ -116,7 +122,7 @@ jobs:
116122
labels: ${{ steps.meta.outputs.labels }}
117123
annotations: ${{ steps.meta.outputs.annotations }}
118124
tags: ${{ steps.meta.outputs.tags }}
119-
push: ${{ github.event_name != 'pull_request' }}
125+
push: true
120126
cache-from: type=gha,scope=alpine-slim
121127
cache-to: type=gha,mode=min,scope=alpine-slim
122128

@@ -155,6 +161,11 @@ jobs:
155161
runs-on: ubuntu-24.04
156162
strategy:
157163
fail-fast: false
164+
services:
165+
registry:
166+
image: registry:2
167+
ports:
168+
- 5000:5000
158169
steps:
159170
- name: Check out the codebase
160171
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -211,6 +222,7 @@ jobs:
211222
ghcr.io/nginx/nginx-unprivileged
212223
public.ecr.aws/nginx/nginx-unprivileged
213224
quay.io/nginx/nginx-unprivileged
225+
${{ github.event_name == 'pull_request' && 'localhost:5000/nginx-unprivileged' || '' }}
214226
tags: |
215227
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine
216228
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine${{ needs.version.outputs.distro }}
@@ -234,9 +246,10 @@ jobs:
234246
labels: ${{ steps.meta.outputs.labels }}
235247
annotations: ${{ steps.meta.outputs.annotations }}
236248
tags: ${{ steps.meta.outputs.tags }}
237-
push: ${{ github.event_name != 'pull_request' }}
249+
push: true
238250
cache-from: type=gha,scope=alpine
239251
cache-to: type=gha,mode=min,scope=alpine
252+
build-args: ${{ github.event_name == 'pull_request' && 'IMAGE=localhost:5000/nginx-unprivileged:alpine-slim' || '' }}
240253

241254
- name: Sign Docker Hub Manifest
242255
if: ${{ github.event_name != 'pull_request' }}
@@ -273,6 +286,11 @@ jobs:
273286
runs-on: ubuntu-24.04
274287
strategy:
275288
fail-fast: false
289+
services:
290+
registry:
291+
image: registry:2
292+
ports:
293+
- 5000:5000
276294
steps:
277295
- name: Check out the codebase
278296
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -329,6 +347,7 @@ jobs:
329347
ghcr.io/nginx/nginx-unprivileged
330348
public.ecr.aws/nginx/nginx-unprivileged
331349
quay.io/nginx/nginx-unprivileged
350+
${{ github.event_name == 'pull_request' && 'localhost:5000/nginx-unprivileged' || '' }}
332351
tags: |
333352
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine-perl
334353
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine${{ needs.version.outputs.distro }}-perl
@@ -352,9 +371,10 @@ jobs:
352371
labels: ${{ steps.meta.outputs.labels }}
353372
annotations: ${{ steps.meta.outputs.annotations }}
354373
tags: ${{ steps.meta.outputs.tags }}
355-
push: ${{ github.event_name != 'pull_request' }}
374+
push: true
356375
cache-from: type=gha,scope=alpine-perl
357376
cache-to: type=gha,mode=min,scope=alpine-perl
377+
build-args: ${{ github.event_name == 'pull_request' && 'IMAGE=localhost:5000/nginx-unprivileged:alpine' || '' }}
358378

359379
- name: Sign Docker Hub Manifest
360380
if: ${{ github.event_name != 'pull_request' }}
@@ -391,6 +411,11 @@ jobs:
391411
runs-on: ubuntu-24.04
392412
strategy:
393413
fail-fast: false
414+
services:
415+
registry:
416+
image: registry:2
417+
ports:
418+
- 5000:5000
394419
steps:
395420
- name: Check out the codebase
396421
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -447,6 +472,7 @@ jobs:
447472
ghcr.io/nginx/nginx-unprivileged
448473
public.ecr.aws/nginx/nginx-unprivileged
449474
quay.io/nginx/nginx-unprivileged
475+
${{ github.event_name == 'pull_request' && 'localhost:5000/nginx-unprivileged' || '' }}
450476
tags: |
451477
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine-otel
452478
type=raw,value=${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}.${{ needs.version.outputs.patch }}-alpine${{ needs.version.outputs.distro }}-otel
@@ -470,9 +496,10 @@ jobs:
470496
labels: ${{ steps.meta.outputs.labels }}
471497
annotations: ${{ steps.meta.outputs.annotations }}
472498
tags: ${{ steps.meta.outputs.tags }}
473-
push: ${{ github.event_name != 'pull_request' }}
499+
push: true
474500
cache-from: type=gha,scope=alpine-otel
475501
cache-to: type=gha,mode=min,scope=alpine-otel
502+
build-args: ${{ github.event_name == 'pull_request' && 'IMAGE=localhost:5000/nginx-unprivileged:alpine' || '' }}
476503

477504
- name: Sign Docker Hub Manifest
478505
if: ${{ github.event_name != 'pull_request' }}

0 commit comments

Comments
 (0)