From 3993930f5104b25bbe62c10d5880afe1bde5e2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Leherpeur?= Date: Mon, 8 Apr 2024 12:37:32 +0200 Subject: [PATCH] Add CI to build and push docker images automatically --- .github/workflows/build-push.yaml | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build-push.yaml diff --git a/.github/workflows/build-push.yaml b/.github/workflows/build-push.yaml new file mode 100644 index 0000000..f27bab9 --- /dev/null +++ b/.github/workflows/build-push.yaml @@ -0,0 +1,48 @@ +name: Build and push docker images + +on: + pull_request: + push: + branches: + - master + +jobs: + build-and-push: + name: Build and Push docker images for ${{ matrix.php }} + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.4', '8.0', '8.1', '8.2', '8.3'] + steps: + - + name: Checkout + uses: actions/checkout@v4 + + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - + name: Build and push base + uses: docker/build-push-action@v5 + with: + context: "./${{ matrix.php }}/base" + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ format('amenophis/nginx-php-fpm:{0}{1}', matrix.php, github.event.event_name == 'pull_request' && format('-{0}', github.event.number) || '') }} + + - + name: Build and push php-all-exts + uses: docker/build-push-action@v5 + with: + context: "./${{ matrix.php }}/php-all-exts" + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ format('amenophis/nginx-php-fpm:{0}-all-exts{1}', matrix.php, github.event.event_name == 'pull_request' && format('-{0}', github.event.number) || '') }}