45
45
- name : Set up Docker Buildx
46
46
uses : docker/setup-buildx-action@v3
47
47
48
+ # BUILD AMD64 IMAGE
49
+ - name : Build PHP Base Image - amd64
50
+ uses : docker/build-push-action@v6
51
+ with :
52
+ platforms : linux/amd64
53
+ context : .
54
+ file : flavors/vanilla/Dockerfile
55
+ load : true
56
+ cache-from : type=gha
57
+ cache-to : type=gha,mode=max
58
+ build-args : |
59
+ PHP_VERSION=${{ matrix.php_version }}
60
+ tags : |
61
+ fbraz3/php-cli:${{ matrix.php_version }}-amd64
62
+
63
+ - name : Test images - amd64
64
+ run : |
65
+ docker run --rm --platform=linux/amd64 fbraz3/php-cli:${{ matrix.php_version }}-amd64 -v
66
+ docker run --rm --platform=linux/amd64 fbraz3/php-cli:${{ matrix.php_version }}-amd64 -v | grep -q "${{ matrix.php_version }}" || exit 1
67
+ env :
68
+ PHP_VERSION : ${{ matrix.php_version }}
69
+
70
+ # BUILD ARM64 IMAGE
71
+ - name : Build PHP Base Image - arm64
72
+ uses : docker/build-push-action@v6
73
+ with :
74
+ platforms : linux/arm64
75
+ context : .
76
+ file : flavors/vanilla/Dockerfile
77
+ load : true
78
+ cache-from : type=gha
79
+ cache-to : type=gha,mode=max
80
+ build-args : |
81
+ PHP_VERSION=${{ matrix.php_version }}
82
+ tags : |
83
+ fbraz3/php-cli:${{ matrix.php_version }}-arm64
84
+
85
+ - name : Test images - arm64
86
+ run : |
87
+ docker run --rm --platform=linux/arm64 fbraz3/php-cli:${{ matrix.php_version }}-arm64 -v
88
+ docker run --rm --platform=linux/arm64 fbraz3/php-cli:${{ matrix.php_version }}-arm64 -v | grep -q "${{ matrix.php_version }}" || exit 1
89
+ env :
90
+ PHP_VERSION : ${{ matrix.php_version }}
91
+
92
+ # BUILD AND PUSH IMAGES TO BOTH ARCHITECTURES
93
+ # Github Actions cache is used to speed up the build process and ensure that the tests are run on the latest image
48
94
- name : Login to Docker Hub
49
95
uses : docker/login-action@v3
50
96
with :
@@ -67,12 +113,3 @@ jobs:
67
113
fbraz3/php-base:${{ matrix.php_version }}
68
114
${{ matrix.is_latest && 'fbraz3/php-cli:latest' || '' }}
69
115
${{ matrix.is_latest && 'fbraz3/php-base:latest' || '' }}
70
-
71
- - name : Test images
72
- run : |
73
- docker run --rm --platform=linux/amd64 fbraz3/php-cli:${{ matrix.php_version }} -v
74
- docker run --rm --platform=linux/arm64 fbraz3/php-cli:${{ matrix.php_version }} -v
75
- docker run --rm --platform=linux/amd64 fbraz3/php-cli:${{ matrix.php_version }} -v | grep -q "${{ matrix.php_version }}" || exit 1
76
- docker run --rm --platform=linux/arm64 fbraz3/php-cli:${{ matrix.php_version }} -v | grep -q "${{ matrix.php_version }}" || exit 1
77
- env :
78
- PHP_VERSION : ${{ matrix.php_version }}
0 commit comments