Skip to content

Commit 6dba94f

Browse files
authored
Merge pull request #56 from laradock/multi-platform
publish images supported multi platform
2 parents 3573bcb + 7999e41 commit 6dba94f

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

.github/workflows/dockerimage.yml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,44 @@ jobs:
1717
matrix:
1818
php_version: ["5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0"]
1919
steps:
20-
- uses: actions/checkout@v2
21-
- name: Build the Docker image
22-
run: |
23-
docker build . --file Dockerfile-${{ matrix.php_version }} --tag laradock/php-fpm:${{ env.TAG_PREFIX }}-${{ matrix.php_version }}
24-
docker image ls
25-
26-
- name: Push image to Docker hub
27-
if: ${{ success() && (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }}
28-
run: |
29-
echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
30-
docker push laradock/php-fpm:${{ env.TAG_PREFIX }}-${{ matrix.php_version }}
31-
docker logout
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Docker meta
24+
id: meta
25+
uses: crazy-max/ghaction-docker-meta@v2
26+
with:
27+
images:
28+
laradock/php-fpm
29+
flavor: |
30+
suffix=-${{ matrix.php_version }}
31+
tags: |
32+
type=schedule,pattern={{date 'YYYYMMDD'}}
33+
type=ref,event=branch
34+
type=semver,pattern={{version}}
35+
type=raw,value=latest
36+
37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v1
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v1
42+
43+
- name: Login to Docker Hub
44+
if: ${{ (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }}
45+
uses: docker/login-action@v1
46+
with:
47+
username: ${{ secrets.DOCKER_HUB_USER }}
48+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
49+
50+
- name: Build and push
51+
uses: docker/build-push-action@v2
52+
with:
53+
file: Dockerfile-${{ matrix.php_version }}
54+
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
55+
push: ${{ (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
58+
- name: check
59+
run: |
60+
docker image ls

0 commit comments

Comments
 (0)