-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild-centos-php-test-images-zts.yml
More file actions
135 lines (125 loc) · 5.67 KB
/
build-centos-php-test-images-zts.yml
File metadata and controls
135 lines (125 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Build CentOS PHP test images (ZTS)
on:
workflow_dispatch:
push:
paths:
- .github/workflows/Dockerfile.centos-php-test-zts
- .github/workflows/build-centos-php-test-images-zts.yml
env:
REGISTRY: ghcr.io
IMAGE_NAME: aikidosec/firewall-php-test-centos-zts
VERSION: v2
jobs:
build-amd64:
runs-on: ubuntu-24.04
strategy:
matrix:
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
fail-fast: false
permissions: { contents: read, packages: write }
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare FrankenPHP binary directory
run: mkdir -p frankenphp-binary
- name: Extract FrankenPHP binary from Docker image
if: matrix.php_version >= '8.2'
run: |
PHP_VERSION="${{ matrix.php_version }}"
docker pull --platform linux/amd64 dunglas/frankenphp:php${PHP_VERSION}-bookworm
docker create --platform linux/amd64 --name temp-frankenphp dunglas/frankenphp:php${PHP_VERSION}-bookworm
docker cp temp-frankenphp:/usr/local/bin/frankenphp frankenphp-binary/frankenphp
mkdir -p frankenphp-binary/lib
docker cp temp-frankenphp:/usr/local/lib/libphp.so frankenphp-binary/lib/libphp.so
docker cp temp-frankenphp:/usr/local/lib/libwatcher-c.so.0 frankenphp-binary/lib/libwatcher-c.so.0 || true
docker cp temp-frankenphp:/lib/x86_64-linux-gnu/libargon2.so.1 frankenphp-binary/lib/libargon2.so.1 || true
docker rm temp-frankenphp
chmod +x frankenphp-binary/frankenphp
echo "Extracted FrankenPHP files:"
ls -lh frankenphp-binary/
ls -lh frankenphp-binary/lib/ || true
- name: Build & push (amd64)
uses: docker/build-push-action@v6
with:
context: .
file: .github/workflows/Dockerfile.centos-php-test-zts
platforms: linux/amd64
push: true
build-args: |
PHP_VERSION=${{ matrix.php_version }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-amd64-${{ env.VERSION }}
#cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ matrix.php_version }}-amd64-${{ env.VERSION }}
#cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ matrix.php_version }}-amd64-${{ env.VERSION }},mode=max
build-arm64:
runs-on: ubuntu-24.04-arm
strategy:
matrix:
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
fail-fast: false
permissions: { contents: read, packages: write }
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare FrankenPHP binary directory
run: mkdir -p frankenphp-binary
- name: Extract FrankenPHP binary from Docker image
if: matrix.php_version >= '8.2'
run: |
PHP_VERSION="${{ matrix.php_version }}"
docker pull --platform linux/arm64 dunglas/frankenphp:php${PHP_VERSION}-bookworm
docker create --platform linux/arm64 --name temp-frankenphp dunglas/frankenphp:php${PHP_VERSION}-bookworm
docker cp temp-frankenphp:/usr/local/bin/frankenphp frankenphp-binary/frankenphp
mkdir -p frankenphp-binary/lib
docker cp temp-frankenphp:/usr/local/lib/libphp.so frankenphp-binary/lib/libphp.so
docker cp temp-frankenphp:/usr/local/lib/libwatcher-c.so.0 frankenphp-binary/lib/libwatcher-c.so.0 || true
docker cp temp-frankenphp:/lib/aarch64-linux-gnu/libargon2.so.1 frankenphp-binary/lib/libargon2.so.1 || true
docker rm temp-frankenphp
chmod +x frankenphp-binary/frankenphp
echo "Extracted FrankenPHP files:"
ls -lh frankenphp-binary/
ls -lh frankenphp-binary/lib/ || true
- name: Build & push (arm64)
uses: docker/build-push-action@v6
with:
context: .
file: .github/workflows/Dockerfile.centos-php-test-zts
platforms: linux/arm64
push: true
build-args: |
PHP_VERSION=${{ matrix.php_version }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}-arm64-${{ env.VERSION }}
#cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ matrix.php_version }}-arm64-${{ env.VERSION }}
#cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ matrix.php_version }}-arm64-${{ env.VERSION }},mode=max
publish-manifests:
runs-on: ubuntu-24.04
needs: [build-amd64, build-arm64]
strategy:
matrix:
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
fail-fast: false
permissions: { contents: read, packages: write }
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multi-arch manifest
run: |
IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
V=${{ matrix.php_version }}
docker buildx imagetools create \
--tag ${IMAGE}:${V}-${{ env.VERSION }} \
${IMAGE}:${V}-amd64-${{ env.VERSION }} \
${IMAGE}:${V}-arm64-${{ env.VERSION }}