From c48a18220699b7f5d26d416ba6e4034ff5f29f42 Mon Sep 17 00:00:00 2001 From: "Laisky.Cai" Date: Fri, 20 Dec 2024 02:36:50 +0000 Subject: [PATCH] chore: add CI workflows for building and pushing arm64 Docker images --- .github/workflows/ci.yml | 61 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdebc549..1d9ddbb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: - "master" - "main" - # - "test/ci" + - "test/ci" # - "feature/flux" jobs: @@ -82,3 +82,62 @@ jobs: cd /home/laisky/repo/VPS docker-compose -f b1-docker-compose.yml up -d --remove-orphans --force-recreate oneapi docker ps + + build_arm64_hash: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - 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: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Add SHORT_SHA env property with commit short sha + run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV + + - name: Build and push arm64 hash label + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ppcelery/one-api:arm64-${{ env.SHORT_SHA }} + platforms: linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + + build_arm64_latest: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - 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: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push arm64 latest + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ppcelery/one-api:arm64-latest + platforms: linux/arm64 + cache-from: type=gha + # cache-to: type=gha,mode=max