Skip to content

Commit c39c956

Browse files
committed
feat(examples/buildx_arm64): Create cross platform build example using buildx
1 parent 155a494 commit c39c956

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

examples/buildx_arm64/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM debian:12
2+
WORKDIR /app
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends curl ca-certificates && \
5+
rm -rf /var/lib/apt/lists/*
6+
COPY install.sh .
7+
RUN sh install.sh

examples/buildx_arm64/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
default: build-and-load
2+
3+
all: create-builder build-and-load build-and-push run
4+
5+
install-deps-debian:
6+
apt-get install -y qemu qemu-user-static binfmt-support
7+
8+
create-builder:
9+
docker buildx create --name mybuilder --use
10+
11+
build-and-load:
12+
docker buildx build . --platform linux/arm64 -t ttl.sh/slu-arm64 --load
13+
14+
build-and-push:
15+
docker buildx build . --platform linux/arm64 -t ttl.sh/slu-arm64 --push
16+
17+
run:
18+
docker run --rm -it ttl.sh/slu-arm64

examples/buildx_arm64/install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
VERSION=v0.73.0 && \
4+
OS=linux && \
5+
ARCH=arm64 && \
6+
ORG=sikalabs && \
7+
BIN=slu && \
8+
curl -fsSL https://github.com/${ORG}/${BIN}/releases/download/${VERSION}/${BIN}_${VERSION}_${OS}_${ARCH}.tar.gz -o ${BIN}_${VERSION}_${OS}_${ARCH}.tar.gz && \
9+
tar -xzf ${BIN}_${VERSION}_${OS}_${ARCH}.tar.gz ${BIN} && \
10+
rm ${BIN}_${VERSION}_${OS}_${ARCH}.tar.gz && \
11+
mv ${BIN} /usr/local/bin/

0 commit comments

Comments
 (0)