From 66eb6bc56296da6e5198af5b50d5a4be4ef735b8 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Sun, 5 May 2024 10:53:18 +0000 Subject: [PATCH] ci: build arm image --- .github/workflows/build-publish-latest.yaml | 20 ++++++++++++------- .../workflows/build-publish-release-tag.yaml | 17 +++++++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-publish-latest.yaml b/.github/workflows/build-publish-latest.yaml index e6ef9a4..f3783fb 100644 --- a/.github/workflows/build-publish-latest.yaml +++ b/.github/workflows/build-publish-latest.yaml @@ -28,10 +28,16 @@ jobs: run: | cd web npm run build - - name: Build image - run: | - docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/free-one-api:latest . - - name: Publish image - run: | - docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} - docker push ${{ secrets.DOCKER_HUB_USERNAME }}/free-one-api:latest \ No newline at end of file + # - name: Build image + # run: | + # docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/free-one-api:latest . + # - name: Publish image + # run: | + # docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} + # docker push ${{ secrets.DOCKER_HUB_USERNAME }}/free-one-api:latest + - name: Login to Registry + run: docker login --username=${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Create Buildx + run: docker buildx create --name mybuilder --use + - name: Build # image name + run: docker buildx build --platform linux/arm64,linux/amd64 -t rockchin/free-one-api:latest . --push diff --git a/.github/workflows/build-publish-release-tag.yaml b/.github/workflows/build-publish-release-tag.yaml index 0cf464a..7bda8d7 100644 --- a/.github/workflows/build-publish-release-tag.yaml +++ b/.github/workflows/build-publish-release-tag.yaml @@ -36,11 +36,18 @@ jobs: id: get_version if: (startsWith(env.GITHUB_REF, 'refs/tags/')||startsWith(github.ref, 'refs/tags/')) && startsWith(github.repository, 'RockChinQ/free-one-api') run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - name: Build image # image name: rockchin/free-one-api: - run: docker build --network=host -t rockchin/free-one-api:${{ steps.get_version.outputs.VERSION }} . + # - name: Build image # image name: rockchin/free-one-api: + # run: docker build --network=host -t rockchin/free-one-api:${{ steps.get_version.outputs.VERSION }} . + # - name: Login to Registry + # run: docker login --username=${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_PASSWORD }} + + # - name: Push release image + # if: (startsWith(env.GITHUB_REF, 'refs/tags/')||startsWith(github.ref, 'refs/tags/')) && startsWith(github.repository, 'RockChinQ/free-one-api') + # run: docker push rockchin/free-one-api:${{ steps.get_version.outputs.VERSION }} - name: Login to Registry run: docker login --username=${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_PASSWORD }} - - - name: Push release image + - name: Create Buildx + run: docker buildx create --name mybuilder --use + - name: Build # image name if: (startsWith(env.GITHUB_REF, 'refs/tags/')||startsWith(github.ref, 'refs/tags/')) && startsWith(github.repository, 'RockChinQ/free-one-api') - run: docker push rockchin/free-one-api:${{ steps.get_version.outputs.VERSION }} + run: docker buildx build --platform linux/arm64,linux/amd64 -t rockchin/free-one-api:${{ steps.get_version.outputs.VERSION }} . --push