Skip to content

Commit 5e6e3f0

Browse files
committed
ci: multi-arch build
1 parent f5e17fd commit 5e6e3f0

File tree

23 files changed

+38
-18
lines changed

23 files changed

+38
-18
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,35 @@ jobs:
2121
- pcntl
2222
- zip
2323
- intl
24-
name: ext-${{ matrix.extension }}@php${{ matrix.php_version }}
24+
arch:
25+
- amd64
26+
- arm64
27+
name: ext-${{ matrix.extension }}@php${{ matrix.php_version }}@${{ matrix.arch }}
2528
steps:
26-
- uses: shivammathur/setup-php@v2
27-
with:
28-
php-version: ${{ matrix.php_version }}
29+
- uses: actions/checkout@v4
2930

30-
- name: Find extension directory
31-
id: extension_dir
32-
run: |
33-
php -r 'echo "extension_dir=" . ini_get("extension_dir");' >> "$GITHUB_OUTPUT"
31+
- name: Set up QEMU
32+
uses: docker/setup-qemu-action@v3
33+
with:
34+
platforms: linux/${{ matrix.arch }}
3435

35-
- name: Install build script
36-
run: |
37-
curl https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
38-
-o /usr/local/bin/install-php-extensions
39-
chmod +x /usr/local/bin/install-php-extensions
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
with:
39+
platforms: linux/${{ matrix.arch }}
4040

41-
- name: Build extension
42-
run: |
43-
install-php-extensions ${{ matrix.extension }}
41+
- name: Build and push
42+
uses: docker/build-push-action@v6
43+
with:
44+
platforms: linux/${{ matrix.arch }}
45+
push: false
46+
outputs: .
4447

4548
- name: Archive extension
4649
uses: actions/upload-artifact@v4
4750
with:
48-
name: ext-${{ matrix.extension }}-php-${{ matrix.php_version }}
49-
path: ${{ steps.extension_dir.outputs.extension_dir }}/${{ matrix.extension }}.so
51+
name: ext-${{ matrix.extension }}-php-${{ matrix.php_version }}-${{ matrix.arch }}
52+
path: ${{ matrix.extension }}.so
5053
retention-days: 1
5154

5255
upload:

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG PHP_VERSION=8.4
2+
3+
FROM php:${PHP_VERSION}-cli AS build
4+
5+
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
6+
7+
ARG EXTENSION=pgsql
8+
9+
RUN EXTENSION_DIR="$(php -r "echo ini_get('extension_dir');")" && \
10+
install-php-extensions "${EXTENSION}" && \
11+
mkdir /data && \
12+
cp "${EXTENSION_DIR}/${EXTENSION}.so" /data
13+
14+
15+
FROM scratch
16+
17+
COPY --from=build /data/* .
-574 KB
Binary file not shown.
-582 KB
Binary file not shown.
-638 KB
Binary file not shown.
-1010 KB
Binary file not shown.
-1010 KB
Binary file not shown.
-1.14 MB
Binary file not shown.
-50.3 KB
Binary file not shown.
-50.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)