Skip to content

Commit c60dc0e

Browse files
committed
support multi platform
1 parent 9f63269 commit c60dc0e

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

.github/workflows/dockerpublish.yml

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

0 commit comments

Comments
 (0)