add support for multiarch builds

This commit is contained in:
Lyn 2024-08-26 22:41:01 +01:00
parent a1a69f0fa9
commit 63ea699d18
No known key found for this signature in database
2 changed files with 18 additions and 9 deletions

View File

@ -1,18 +1,22 @@
FROM debian:12-slim AS downloader
FROM --platform=$BUILDPLATFORM alpine AS downloader_start
ARG VERSION
ARG TARGETARCH
WORKDIR /tmp/download
RUN apk update && apk add unzip wget --no-cache
RUN apt-get update
RUN apt-get install unzip -y
FROM downloader_start AS downloader_amd64
ADD "https://github.com/kinode-dao/kinode/releases/download/${VERSION}/kinode-x86_64-unknown-linux-gnu.zip" kinode-x86_64-unknown-linux-gnu.zip
RUN unzip kinode-x86_64-unknown-linux-gnu.zip
FROM downloader_start AS downloader_arm64
ADD "https://github.com/kinode-dao/kinode/releases/download/${VERSION}/kinode-aarch64-unknown-linux-gnu.zip" kinode-aarch64-unknown-linux-gnu.zip
RUN unzip kinode-aarch64-unknown-linux-gnu.zip
FROM downloader_${TARGETARCH} AS downloader
FROM debian:12-slim
RUN apt-get update
RUN apt-get install openssl -y
RUN apt-get update && apt-get install openssl -y
COPY --from=downloader /tmp/download/kinode /bin/kinode

View File

@ -150,7 +150,12 @@ To build a local Docker image, run the following command in this project root.
```bash
# The `VERSION` may be replaced with the tag of a GitHub release
docker buildx build -t 0xlynett/kinode . --build-arg VERSION=v0.9.1 --platform linux/amd64,linux/arm64
# Build for your system's architecture
docker build . -t 0xlynett/kinode --build-arg VERSION=v0.9.1
# Build a multiarch image
docker buildx build . --platform arm64,amd64 --build-arg VERSION=v0.9.1 -t 0xlynett/kinode
```
For example: