Skip to content

Commit 640515e

Browse files
Merge pull request #128 from wasmCloud/fix/arm_build
Adds support for building arm image
2 parents ec889ac + 3c8ebd2 commit 640515e

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@ jobs:
195195
- name: Set up Docker Buildx
196196
uses: docker/setup-buildx-action@v2
197197

198+
- uses: actions/download-artifact@v3
199+
with:
200+
name: wadm-${{ env.RELEASE_VERSION }}-linux-aarch64
201+
path: ./artifacts
202+
- run: mv ./artifacts/wadm ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-aarch64 && chmod +x ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-aarch64
203+
204+
- uses: actions/download-artifact@v3
205+
with:
206+
name: wadm-${{ env.RELEASE_VERSION }}-linux-amd64
207+
path: ./artifacts
208+
- run: mv ./artifacts/wadm ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-amd64 && chmod +x ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-amd64
209+
198210
- name: Login to GitHub Container Registry
199211
uses: docker/login-action@v2
200212
with:
@@ -211,6 +223,11 @@ jobs:
211223
if: startsWith(github.ref, 'refs/tags/v')
212224
with:
213225
push: true
226+
platforms: linux/amd64,linux/arm64
227+
context: ./
228+
build-args: |
229+
BIN_ARM64=./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-aarch64
230+
BIN_AMD64=./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-amd64
214231
tags: ghcr.io/${{ env.OWNER }}/wadm:latest,ghcr.io/${{ env.OWNER }}/wadm:${{ env.RELEASE_VERSION }}
215232

216233
- name: Build and push (main)

Dockerfile

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
FROM rust:1.68.0-slim as builder
1+
FROM debian:bullseye-slim AS base
22

3-
WORKDIR /usr/src/wadm
3+
FROM base AS base-amd64
4+
ARG BIN_AMD64
5+
ARG BIN=$BIN_AMD64
46

5-
COPY . /usr/src/wadm/
7+
FROM base AS base-arm64
8+
ARG BIN_ARM64
9+
ARG BIN=$BIN_ARM64
610

7-
RUN rustup target add x86_64-unknown-linux-musl
8-
RUN apt update && apt install -y musl-tools musl-dev
9-
RUN update-ca-certificates
10-
11-
RUN cargo build --bin wadm --features cli --target x86_64-unknown-linux-musl --release
12-
13-
FROM alpine:3.16.0 AS runtime
11+
FROM base-$TARGETARCH
1412

1513
ARG USERNAME=wadm
1614
ARG USER_UID=1000
1715
ARG USER_GID=$USER_UID
1816

19-
RUN addgroup -g $USER_GID $USERNAME \
20-
&& adduser -D -u $USER_UID -G $USERNAME $USERNAME
17+
RUN addgroup --gid $USER_GID $USERNAME \
18+
&& adduser --disabled-login -u $USER_UID --ingroup $USERNAME $USERNAME
2119

22-
# Copy application binary from builder image
23-
COPY --from=builder --chown=$USERNAME /usr/src/wadm/target/x86_64-unknown-linux-musl/release/wadm /usr/local/bin/wadm
20+
# Copy application binary from disk
21+
COPY --chown=$USERNAME ${BIN} /usr/local/bin/wadm
2422

2523
USER $USERNAME
2624
# Run the application

0 commit comments

Comments
 (0)