From fba9e03340a17e8d2ba3d61796c625f80f348249 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Sun, 3 Nov 2024 16:42:28 +0900 Subject: [PATCH 1/2] Refactor `tools/docker.sh` --- .github/workflows/release.yaml | 2 +- tools/docker.sh | 34 +++++++--------------------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 79336f0..613184a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -23,4 +23,4 @@ jobs: with: fetch-depth: 0 - run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin - - run: tools/docker.sh "linux/amd64,linux/arm64" + - run: tools/docker.sh diff --git a/tools/docker.sh b/tools/docker.sh index 6e9c181..29b7509 100755 --- a/tools/docker.sh +++ b/tools/docker.sh @@ -2,30 +2,10 @@ set -e -check_buildx(){ - docker buildx version &>/dev/null - return $? -} - -build_image() { - local platforms=${1:-} - if [ ! -z "$platforms" ] && check_buildx; then - echo "Building for platforms: $platforms" - # Build for each git tag and latest - for tag in latest $(git tag --points-at | sed s/^v//); do - docker buildx build \ - --platform "$platforms" \ - --tag raviqqe/muffet:$tag \ - --push \ - . - done - else - for tag in latest $(git tag --points-at | sed s/^v//); do - docker build -t raviqqe/muffet:$tag . - docker push raviqqe/muffet:$tag - done - fi -} - - -build_image "$@" \ No newline at end of file +for tag in latest $(git tag --points-at | sed s/^v//); do + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag raviqqe/muffet:$tag \ + --push \ + . +done From d9a364b3bb30ebd678125a7dd14f4c9710a52ee7 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Sun, 3 Nov 2024 16:46:48 +0900 Subject: [PATCH 2/2] Set up buildx --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 613184a..443c2de 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,5 +22,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: docker/setup-buildx-action@v3 - run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin - run: tools/docker.sh