diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 30695ed..b411e53 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -17,15 +17,44 @@ jobs: matrix: php_version: ["5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0"] steps: - - uses: actions/checkout@v2 - - name: Build the Docker image - run: | - docker build . --file Dockerfile-${{ matrix.php_version }} --tag laradock/php-fpm:${{ env.TAG_PREFIX }}-${{ matrix.php_version }} - docker image ls - - - name: Push image to Docker hub - if: ${{ success() && (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }} - run: | - echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin - docker push laradock/php-fpm:${{ env.TAG_PREFIX }}-${{ matrix.php_version }} - docker logout + - name: Checkout + uses: actions/checkout@v2 + + - name: Docker meta + id: meta + uses: crazy-max/ghaction-docker-meta@v2 + with: + images: + laradock/php-fpm + flavor: | + suffix=-${{ matrix.php_version }} + tags: | + type=schedule,pattern={{date 'YYYYMMDD'}} + type=ref,event=branch + type=semver,pattern={{version}} + type=raw,value=latest + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Docker Hub + if: ${{ (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }} + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + file: Dockerfile-${{ matrix.php_version }} + platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6 + push: ${{ (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }} + tags: ${{ steps.meta.outputs.tags }} + + - name: check + run: | + docker image ls