Skip to content

Commit a59744b

Browse files
author
Felipe Almeida Baccaro
committed
reorganizing how build and push images using github workflow strategy matrix. tags follow the pattern php:version-php-os-environment for easy maintenance.
1 parent d623b34 commit a59744b

19 files changed

Lines changed: 90 additions & 339 deletions

‎.github/workflows/docker-image.yml‎

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ on:
33
push:
44
branches: [ "master" ]
55
jobs:
6-
build:
6+
build_push_images:
77
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
max-parallel: 2
11+
matrix:
12+
version: ["8.3-cli", "8.3-fpm", "8.4-cli", "8.4-fpm", "8.5-cli", "8.5-fpm" ]
13+
environment: ["dev","prod"]
14+
os: ["alpine"]
815
steps:
916
- name: Login to Docker Hub
1017
uses: docker/login-action@v3
@@ -13,21 +20,11 @@ jobs:
1320
password: ${{ secrets.DOCKERHUB_TOKEN }}
1421
- name: Checkout code
1522
uses: actions/checkout@v4
16-
- name: "Build images"
17-
if: success()
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
- name: build image
26+
run: |
27+
docker build --no-cache --target ${{matrix.environment}} -t ${{ github.repository_owner }}/php:${{matrix.version}}-${{matrix.os}}-${{matrix.environment}} ./${{matrix.os}}
28+
- name: push image
1829
run: |
19-
jq -r 'map(select(.build == true)).[]
20-
| .stages[] as $stage
21-
| "docker build --no-cache --target \($stage) -t \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase) ./\(.path) "
22-
| split("\n") | .[]' versions.json | while read -r image; do
23-
$($image);
24-
done
25-
- name: "Push images"
26-
if: success()
27-
run: |
28-
jq -r 'map(select(.build == true and .push == true)).[]
29-
| .stages[] as $stage
30-
| "docker push \(.namespace)/\(.repository):\(.tag)-\($stage|ascii_downcase)"
31-
| split("\n") | .[]' versions.json | while read -r image; do
32-
eval $image;
33-
done
30+
docker push ${{ github.repository_owner }}/\php:${{matrix.version}}-${{matrix.os}}-${{matrix.environment}}

‎8.3-alpine/fpm/Dockerfile‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎8.4-alpine/cli/Dockerfile‎

Lines changed: 0 additions & 53 deletions
This file was deleted.

‎8.4-alpine/cli/etc/php-ext-xdebug.ini‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎8.4-alpine/fpm/Dockerfile‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎8.4-alpine/fpm/etc/php-ext-xdebug.ini‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎8.4-amazonlinux/cli/Dockerfile‎

Lines changed: 0 additions & 34 deletions
This file was deleted.

‎8.4-amazonlinux/cli/composer-installater.sh‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎8.4-amazonlinux/cli/etc/php-ext-xdebug.ini‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎8.4-amazonlinux/fpm/Dockerfile‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)