Skip to content

Commit

Permalink
try multi-architecture build
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Oct 21, 2024
1 parent 4919122 commit 9991f01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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', 'develop' ] # temporarily add 'develop' for testing multi-arch build
tags: [ '[0-9]+.[0-9]+.[0-9]+' ] # Trigger on version tags like '0.1.0'

jobs:
Expand All @@ -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:
Expand All @@ -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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9991f01

Please sign in to comment.