Skip to content

Commit 23db27d

Browse files
committed
attempt to fix local img just built usage
1 parent 3c892f9 commit 23db27d

File tree

1 file changed

+47
-87
lines changed

1 file changed

+47
-87
lines changed

.github/workflows/ci-cd.yml

Lines changed: 47 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ on:
88

99
jobs:
1010
# ===========================================
11-
# Alpine Base Images (Phase 1)
11+
# Alpine Images (base + nginx in same job)
1212
# ===========================================
13-
build-alpine-base:
13+
build-alpine:
1414
runs-on: ubuntu-latest
1515

1616
strategy:
@@ -35,14 +35,15 @@ jobs:
3535
username: ${{ secrets.DOCKER_USERNAME }}
3636
password: ${{ secrets.DOCKER_PASSWORD }}
3737

38-
- name: Build and export to Docker
38+
# ---- BASE IMAGE ----
39+
- name: Build base image
3940
uses: docker/build-push-action@v6
4041
with:
4142
context: ${{ matrix.version }}${{ matrix.type }}
4243
load: true
4344
tags: kooldev/php:${{ matrix.version }}${{ matrix.type }}
4445

45-
- name: Tests - Basic
46+
- name: Tests (base) - Basic
4647
run: |
4748
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -v
4849
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} composer -V
@@ -53,12 +54,12 @@ jobs:
5354
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep readline
5455
docker run -e ENABLE_XDEBUG=true kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m
5556
56-
- name: Tests - Dockerize
57+
- name: Tests (base) - Dockerize
5758
run: |
5859
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} dockerize --version
5960
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} sh -c 'echo "{{ .Env.TEST_VAR }}" > /tmp/test.tmpl && TEST_VAR=hello dockerize -template /tmp/test.tmpl:/tmp/test.out && cat /tmp/test.out | grep hello'
6061
61-
- name: Tests - PHP Extensions
62+
- name: Tests (base) - PHP Extensions
6263
run: |
6364
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i bcmath
6465
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i gd
@@ -70,19 +71,19 @@ jobs:
7071
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i mbstring
7172
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i ldap
7273
73-
- name: Tests - Production Checks
74+
- name: Tests (base) - Production Checks
7475
if: matrix.type == '-prod'
7576
run: |
7677
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i "Zend OPcache"
7778
docker run -e ENABLE_XDEBUG=true kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i xdebug && exit 1 || echo "OK: xdebug not in prod"
7879
79-
- name: Tests - Development Checks
80+
- name: Tests (base) - Development Checks
8081
if: matrix.type == ''
8182
run: |
8283
docker run kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i pcov
8384
docker run -e ENABLE_XDEBUG=true kooldev/php:${{ matrix.version }}${{ matrix.type }} php -m | grep -i xdebug
8485
85-
- name: Build and push
86+
- name: Push base image
8687
uses: docker/build-push-action@v6
8788
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-php'
8889
with:
@@ -91,39 +92,13 @@ jobs:
9192
push: true
9293
tags: kooldev/php:${{ matrix.version }}${{ matrix.type }}
9394

94-
# ===========================================
95-
# Alpine Nginx Images (Phase 2 - depends on base)
96-
# ===========================================
97-
build-alpine-nginx:
98-
runs-on: ubuntu-latest
99-
needs: build-alpine-base
100-
101-
strategy:
102-
matrix:
103-
version: ["8.1", "8.2", "8.3", "8.4"]
104-
type: ["", "-prod"]
105-
106-
steps:
107-
- name: Checkout code
108-
uses: actions/checkout@v5.0.0
109-
110-
- name: Setup QEMU
111-
uses: docker/setup-qemu-action@v3
112-
113-
- name: Setup Docker Buildx
114-
uses: docker/setup-buildx-action@v3
115-
116-
- name: Login to DockerHub
117-
uses: docker/login-action@v3
118-
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-php'
119-
with:
120-
username: ${{ secrets.DOCKER_USERNAME }}
121-
password: ${{ secrets.DOCKER_PASSWORD }}
122-
123-
- name: Build and export to Docker (nginx)
95+
# ---- NGINX IMAGE ----
96+
- name: Build nginx image
12497
uses: docker/build-push-action@v6
12598
with:
12699
context: ${{ matrix.version }}-nginx${{ matrix.type }}
100+
build-contexts: |
101+
kooldev/php:${{ matrix.version }}${{ matrix.type }}=docker-image://kooldev/php:${{ matrix.version }}${{ matrix.type }}
127102
load: true
128103
tags: kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }}
129104

@@ -170,7 +145,7 @@ jobs:
170145
docker run kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }} php -m | grep -i pcov
171146
docker run -e ENABLE_XDEBUG=true kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }} php -m | grep -i xdebug
172147
173-
- name: Build and push (nginx)
148+
- name: Push nginx image
174149
uses: docker/build-push-action@v6
175150
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-php'
176151
with:
@@ -180,11 +155,10 @@ jobs:
180155
tags: kooldev/php:${{ matrix.version }}-nginx${{ matrix.type }}
181156

182157
# ===========================================
183-
# Alpine Node Images (Phase 2 - depends on base)
158+
# Alpine Node Images (depends on base)
184159
# ===========================================
185160
build-alpine-node:
186161
runs-on: ubuntu-latest
187-
needs: build-alpine-base
188162

189163
strategy:
190164
matrix:
@@ -207,10 +181,20 @@ jobs:
207181
username: ${{ secrets.DOCKER_USERNAME }}
208182
password: ${{ secrets.DOCKER_PASSWORD }}
209183

210-
- name: Build and export to Docker (Node)
184+
# Build base first (needed for node)
185+
- name: Build base image (for node dependency)
186+
uses: docker/build-push-action@v6
187+
with:
188+
context: ${{ matrix.version }}
189+
load: true
190+
tags: kooldev/php:${{ matrix.version }}
191+
192+
- name: Build node image
211193
uses: docker/build-push-action@v6
212194
with:
213195
context: ${{ matrix.version }}-node
196+
build-contexts: |
197+
kooldev/php:${{ matrix.version }}=docker-image://kooldev/php:${{ matrix.version }}
214198
load: true
215199
tags: kooldev/php:${{ matrix.version }}-node
216200

@@ -220,7 +204,7 @@ jobs:
220204
docker run kooldev/php:${{ matrix.version }}-node npm -v
221205
docker run kooldev/php:${{ matrix.version }}-node yarn -v
222206
223-
- name: Build and push (Node)
207+
- name: Push node image
224208
uses: docker/build-push-action@v6
225209
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-php'
226210
with:
@@ -230,9 +214,9 @@ jobs:
230214
tags: kooldev/php:${{ matrix.version }}-node
231215

232216
# ===========================================
233-
# Debian Base Images (Phase 1)
217+
# Debian Images (base + nginx in same job)
234218
# ===========================================
235-
build-debian-base:
219+
build-debian:
236220
runs-on: ubuntu-latest
237221

238222
strategy:
@@ -256,14 +240,15 @@ jobs:
256240
username: ${{ secrets.DOCKER_USERNAME }}
257241
password: ${{ secrets.DOCKER_PASSWORD }}
258242

259-
- name: Build and export to Docker (Debian base)
243+
# ---- BASE IMAGE ----
244+
- name: Build base image (Debian)
260245
uses: docker/build-push-action@v6
261246
with:
262247
context: 8.4-debian${{ matrix.type }}
263248
load: true
264249
tags: kooldev/php:8.4-debian${{ matrix.type }}
265250

266-
- name: Tests (Debian) - Basic
251+
- name: Tests (Debian base) - Basic
267252
run: |
268253
docker run kooldev/php:8.4-debian${{ matrix.type }} php -v
269254
docker run kooldev/php:8.4-debian${{ matrix.type }} composer -V
@@ -274,17 +259,17 @@ jobs:
274259
docker run kooldev/php:8.4-debian${{ matrix.type }} php -m | grep readline
275260
docker run -e ENABLE_XDEBUG=true kooldev/php:8.4-debian${{ matrix.type }} php -m
276261
277-
- name: Tests (Debian) - Dockerize
262+
- name: Tests (Debian base) - Dockerize
278263
run: |
279264
docker run kooldev/php:8.4-debian${{ matrix.type }} dockerize --version
280265
docker run kooldev/php:8.4-debian${{ matrix.type }} bash -c 'echo "{{ .Env.TEST_VAR }}" > /tmp/test.tmpl && TEST_VAR=hello dockerize -template /tmp/test.tmpl:/tmp/test.out && cat /tmp/test.out | grep hello'
281266
282-
- name: Tests (Debian) - Gosu user switching
267+
- name: Tests (Debian base) - Gosu user switching
283268
run: |
284269
docker run kooldev/php:8.4-debian${{ matrix.type }} gosu --version
285270
docker run -e ASUSER=1000 kooldev/php:8.4-debian${{ matrix.type }} id | grep "uid=1000"
286271
287-
- name: Tests (Debian) - PHP Extensions
272+
- name: Tests (Debian base) - PHP Extensions
288273
run: |
289274
docker run kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i bcmath
290275
docker run kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i gd
@@ -296,19 +281,19 @@ jobs:
296281
docker run kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i mbstring
297282
docker run kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i ldap
298283
299-
- name: Tests (Debian) - Production Checks
284+
- name: Tests (Debian base) - Production Checks
300285
if: matrix.type == '-prod'
301286
run: |
302287
docker run kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i "Zend OPcache"
303288
docker run -e ENABLE_XDEBUG=true kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i xdebug && exit 1 || echo "OK: xdebug not in prod"
304289
305-
- name: Tests (Debian) - Development Checks
290+
- name: Tests (Debian base) - Development Checks
306291
if: matrix.type == ''
307292
run: |
308293
docker run kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i pcov
309294
docker run -e ENABLE_XDEBUG=true kooldev/php:8.4-debian${{ matrix.type }} php -m | grep -i xdebug
310295
311-
- name: Build and push (Debian base)
296+
- name: Push base image (Debian)
312297
uses: docker/build-push-action@v6
313298
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-php'
314299
with:
@@ -317,38 +302,13 @@ jobs:
317302
push: true
318303
tags: kooldev/php:8.4-debian${{ matrix.type }}
319304

320-
# ===========================================
321-
# Debian Nginx Images (Phase 2 - depends on base)
322-
# ===========================================
323-
build-debian-nginx:
324-
runs-on: ubuntu-latest
325-
needs: build-debian-base
326-
327-
strategy:
328-
matrix:
329-
type: ["", "-prod"]
330-
331-
steps:
332-
- name: Checkout code
333-
uses: actions/checkout@v5.0.0
334-
335-
- name: Setup QEMU
336-
uses: docker/setup-qemu-action@v3
337-
338-
- name: Setup Docker Buildx
339-
uses: docker/setup-buildx-action@v3
340-
341-
- name: Login to DockerHub
342-
uses: docker/login-action@v3
343-
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-php'
344-
with:
345-
username: ${{ secrets.DOCKER_USERNAME }}
346-
password: ${{ secrets.DOCKER_PASSWORD }}
347-
348-
- name: Build and export to Docker (Debian nginx)
305+
# ---- NGINX IMAGE ----
306+
- name: Build nginx image (Debian)
349307
uses: docker/build-push-action@v6
350308
with:
351309
context: 8.4-debian-nginx${{ matrix.type }}
310+
build-contexts: |
311+
kooldev/php:8.4-debian${{ matrix.type }}=docker-image://kooldev/php:8.4-debian${{ matrix.type }}
352312
load: true
353313
tags: kooldev/php:8.4-debian-nginx${{ matrix.type }}
354314

@@ -395,7 +355,7 @@ jobs:
395355
docker run kooldev/php:8.4-debian-nginx${{ matrix.type }} php -m | grep -i pcov
396356
docker run -e ENABLE_XDEBUG=true kooldev/php:8.4-debian-nginx${{ matrix.type }} php -m | grep -i xdebug
397357
398-
- name: Build and push (Debian nginx)
358+
- name: Push nginx image (Debian)
399359
uses: docker/build-push-action@v6
400360
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-php'
401361
with:
@@ -405,12 +365,12 @@ jobs:
405365
tags: kooldev/php:8.4-debian-nginx${{ matrix.type }}
406366

407367
# ===========================================
408-
# Downstream Triggers (after all builds complete)
368+
# Downstream Triggers
409369
# ===========================================
410370
trigger-build-wordpress:
411371
name: Trigger Wordpress Build
412372
runs-on: ubuntu-latest
413-
needs: [build-alpine-nginx, build-alpine-node, build-debian-nginx]
373+
needs: [build-alpine, build-alpine-node, build-debian]
414374
steps:
415375
- name: Trigger build on kool-dev/docker-wordpress
416376
uses: benc-uk/workflow-dispatch@v1.2
@@ -423,7 +383,7 @@ jobs:
423383
trigger-extended-builds:
424384
name: Trigger Extended Builds
425385
runs-on: ubuntu-latest
426-
needs: [build-alpine-nginx, build-alpine-node, build-debian-nginx]
386+
needs: [build-alpine, build-alpine-node, build-debian]
427387
strategy:
428388
matrix:
429389
image:

0 commit comments

Comments
 (0)