From ae216f9640b832ea049d661bb3842e28c3b7b4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=93=AD=E6=98=95?= <715557344@qq.com> Date: Mon, 17 Jun 2024 16:08:54 +0800 Subject: [PATCH] Support build arm64 for base images. --- .github/workflows/build-base.yml | 36 ++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-base.yml b/.github/workflows/build-base.yml index abfac5c..3715a43 100644 --- a/.github/workflows/build-base.yml +++ b/.github/workflows/build-base.yml @@ -9,9 +9,6 @@ on: required: true default: '' -env: - DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_ACCESSTOKEN }} - jobs: build: name: Build Base Image @@ -41,14 +38,35 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - name: Build + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: limingxinleo + password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }} + - name: Build and export to Docker + uses: docker/build-push-action@v5 + with: + context: ${{ matrix.php-version }}/alpine/base + load: true + tags: hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-base + build-args: | + "ALPINE_VERSION=${{ matrix.alpine-version }}" + - name: Check run: | - docker-compose build alpine-base docker run --entrypoint php -v $PWD/tests/base:/opt/www hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-base /opt/www/openssl.php - - name: Push Images to Docker Hub + - name: Push if: ${{ github.event.inputs.event == 'publish' }} - run: | - docker login --username limingxinleo -p $DOCKERHUB_TOKEN - docker push hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-base + uses: docker/build-push-action@v5 + with: + context: ${{ matrix.php-version }}/alpine/base + push: true + platforms: linux/amd64,linux/arm64 + tags: hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-base + build-args: | + "ALPINE_VERSION=${{ matrix.alpine-version }}"