diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 78dd850..6031cae 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -2,7 +2,7 @@ name: Build and Publish on: push: - branches: [ 'main', 'master' ] # Trigger on push to 'main'& 'master' master will be remove step by step + branches: [ 'main', 'master' ] tags: [ '[0-9]+.[0-9]+.[0-9]+' ] # Trigger on version tags like '0.1.0' jobs: @@ -13,6 +13,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Set up QEMU for multi-platform builds + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub uses: docker/login-action@v3 with: @@ -38,15 +44,11 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - # labels: | - # org.opencontainers.image.source=${{ github.repository }} - # org.opencontainers.image.revision=${{ github.sha }} - # org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} - name: Build and push Docker image to DockerHub and GHCR uses: docker/build-push-action@v5 with: - context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 diff --git a/Dockerfile b/Dockerfile index 1cac100..d83ba10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,10 @@ RUN apk update \ && apk add --no-cache bash ARG restic_ver=0.16.0 +ARG TARGETARCH RUN wget -O /tmp/restic.bz2 \ - https://github.com/restic/restic/releases/download/v${restic_ver}/restic_${restic_ver}_linux_amd64.bz2 \ + https://github.com/restic/restic/releases/download/v${restic_ver}/restic_${restic_ver}_linux_${TARGETARCH}.bz2 \ && bunzip2 /tmp/restic.bz2 \ && chmod +x /tmp/restic \ && mv /tmp/restic /usr/local/bin/restic