Skip to content

Commit

Permalink
build(docker): support arm64 docker image (#1351)
Browse files Browse the repository at this point in the history
This PR create a new building target `aarch64-unknonw-linux-musl`, as
`aarch64-unknonw-linux-gnu` is not competible with the docker base image
`scratch`.

Follows the current step, the arm64 docker image will be built after
Github release.
  • Loading branch information
timtorChen authored Nov 11, 2024
1 parent a56f671 commit 62f6087
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cross-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
target: aarch64-unknown-linux-gnu
architecture: arm64
use-cross: true
- os: ubuntu-latest
os-name: linux
target: aarch64-unknown-linux-musl
architecture: arm64
use-cross: true
- os: ubuntu-latest
os-name: linux
target: i686-unknown-linux-gnu
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ jobs:
architecture: arm64
binary-postfix: ""
use-cross: true
- os: ubuntu-latest
os-name: linux
target: aarch64-unknown-linux-musl
architecture: arm64
binary-postfix: ""
use-cross: true
- os: ubuntu-latest
os-name: linux
target: i686-unknown-linux-gnu
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ jobs:
architecture: arm64
binary-postfix: ""
use-cross: true
- os: ubuntu-latest
os-name: linux
target: aarch64-unknown-linux-musl
architecture: arm64
binary-postfix: ""
use-cross: true
- os: ubuntu-latest
os-name: linux
target: i686-unknown-linux-gnu
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ jobs:
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/rustic-rs/rustic:latest,ghcr.io/rustic-rs/rustic:${{ github.ref_name }}
build-args: RUSTIC_VERSION=${{ github.ref_name }}
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
FROM alpine AS builder
ARG RUSTIC_VERSION
RUN wget https://github.com/rustic-rs/rustic/releases/download/${RUSTIC_VERSION}/rustic-${RUSTIC_VERSION}-x86_64-unknown-linux-musl.tar.gz && \
tar -xzf rustic-${RUSTIC_VERSION}-x86_64-unknown-linux-musl.tar.gz && \
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
ASSET="rustic-${RUSTIC_VERSION}-x86_64-unknown-linux-musl.tar.gz";\
elif [ "$TARGETARCH" = "arm64" ]; then \
ASSET="rustic-${RUSTIC_VERSION}-aarch64-unknown-linux-musl.tar.gz"; \
fi; \
wget https://github.com/rustic-rs/rustic/releases/download/${RUSTIC_VERSION}/${ASSET} && \
tar -xzf ${ASSET} && \
mkdir /etc_files && \
touch /etc_files/passwd && \
touch /etc_files/group
Expand Down
10 changes: 5 additions & 5 deletions build-dependencies.just
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ install-default-x86_64-unknown-linux-musl:
sudo apt-get update
sudo apt-get install -y musl-tools

# Install dependencies for the default feature on aarch64-unknown-linux-musl
install-default-aarch64-unknown-linux-musl:
sudo apt-get update
sudo apt-get install -y musl-tools

### MOUNT ###

# Install dependencies for the mount feature on x86_64-unknown-linux-gnu
Expand All @@ -22,11 +27,6 @@ install-mount-i686-unknown-linux-gnu:
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev pkg-config

# Install dependencies for the mount feature on x86_64-unknown-linux-musl
install-mount-x86_64-unknown-linux-musl:
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev pkg-config

# Install dependencies for the mount feature on x86_64-apple-darwin
install-mount-x86_64-apple-darwin:
brew install macfuse
Expand Down

0 comments on commit 62f6087

Please sign in to comment.