Skip to content

Commit

Permalink
Merge pull request #161 from albertborsos/feature/build-images-for-mu…
Browse files Browse the repository at this point in the history
…ltiple-platforms

build images for amd64 and arm64 platform (for Apple Silicon, M1, M2)
  • Loading branch information
schmunk42 committed Apr 13, 2023
2 parents 64f4ef7 + 6b0514e commit 4393ff9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ jobs:
PECL_XDEBUG_INSTALL_SUFFIX: ${{ matrix.pecl-xdebug-suffix }}
PECL_MONGODB_INSTALL_SUFFIX: ${{ matrix.pecl-mongodb-suffix }}
steps:
- uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'amd64,arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set version suffix
if: startsWith(github.ref, 'refs/tags/')
run: echo "PHP_IMAGE_VERSION_SUFFIX=-${GITHUB_REF:10}" >> $GITHUB_ENV
Expand All @@ -136,7 +143,13 @@ jobs:
docker info
docker-compose version
- name: Build Image
run: docker-compose build --build-arg X_LEGACY_GD_LIB=$X_LEGACY_GD_LIB
uses: docker/bake-action@v2
with:
files: docker-compose.yml
load: true
set: |
*.platform=linux/amd64
*.args.X_LEGACY_GD_LIB=${{ matrix.legacy-gd-lib }}
- name: Test
run: |
docker-compose run --rm php-min php -v | grep "Xdebug" && exit 1
Expand All @@ -148,10 +161,25 @@ jobs:
docker images
- name: Login to Docker
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Push docker image
- name: Build and push
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
run: docker-compose push
uses: docker/bake-action@v2
with:
files: docker-compose.yml
push: true
set: |
*.platform=linux/amd64
- name: Build and push docker image (arm64)
if: |
(startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') &&
(github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
uses: docker/bake-action@v2
with:
files: docker-compose.yml
push: true
set: |
*.platform=linux/arm64
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version: '2.2'

networks:
default:

services:

php-min:
Expand Down

0 comments on commit 4393ff9

Please sign in to comment.