From 5129a9f06ee34db4b574c57566b118b63f5acc19 Mon Sep 17 00:00:00 2001 From: Kien Nguyen Date: Tue, 11 Jun 2024 20:15:46 +0200 Subject: [PATCH] feat: use buildx to build on arm and amd arch --- .github/workflows/docker-build.yaml | 5 ++--- .github/workflows/lint.yaml | 35 ----------------------------- .github/workflows/release.yaml | 6 +++-- 3 files changed, 6 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 5aa7ef8..1097dd5 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -62,7 +62,7 @@ jobs: echo "repo_name=$result" >> $GITHUB_OUTPUT - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3 - name: Configure Docker uses: docker/login-action@v1 @@ -73,8 +73,7 @@ jobs: - name: Build and Push Docker image run: | - docker build -t ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REGISTRY_REPO }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ needs.dev-tag.outputs.new_tag }} . - docker push ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REGISTRY_REPO }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ needs.dev-tag.outputs.new_tag }} + docker buildx build --push --platform linux/arm64,linux/amd64 -t ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REGISTRY_REPO }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ needs.dev-tag.outputs.new_tag }} . # Setup and run vulnerability scanner - name: Setup trivy markdown template diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 84f51b5..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Lint -on: [pull_request] - -jobs: - lint-commit: - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper - # list of changed files within `super-linter` - fetch-depth: 0 - - uses: wagoid/commitlint-github-action@v5 - lint-repo: - runs-on: ubuntu-latest - permissions: - contents: read - packages: read - statuses: write - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper - # list of changed files within `super-linter` - fetch-depth: 0 - - - name: Lint Code Base - uses: super-linter/super-linter/slim@v5 - env: - VALIDATE_ALL_CODEBASE: false - VALIDATE_GITHUB_ACTIONS: false - DEFAULT_BRANCH: main - GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 29a3fe9..936d0cb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -63,6 +63,9 @@ jobs: result=$(echo "$GITHUB_REPOSITORY" | awk -F'/' '{print $2}') echo "repo_name=$result" >> $GITHUB_OUTPUT + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3 + - name: Configure Docker uses: docker/login-action@v1 with: @@ -72,8 +75,7 @@ jobs: - name: Build and Push Docker image run: | - docker build -t ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REGISTRY_REPO }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ needs.stable-tag.outputs.new_tag }} . - docker push ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REGISTRY_REPO }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ needs.stable-tag.outputs.new_tag }} + docker buildx build --push --platform linux/arm64,linux/amd64 -t ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REGISTRY_REPO }}/${{ steps.get_repo_name.outputs.repo_name }}:${{ needs.stable-tag.outputs.new_tag }} . release: runs-on: ubuntu-latest