From caed20cc4dd528114af8f28d591653bee289be62 Mon Sep 17 00:00:00 2001 From: Alexa Lake Date: Sun, 23 Feb 2025 20:21:22 -0500 Subject: [PATCH] replaced hard-coded architecture with buildx target --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 637d4e7..80b6855 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,15 @@ RUN apk --no-cache add libc-dev COPY src src COPY Cargo.toml . COPY Cargo.lock . -RUN cargo install --target x86_64-unknown-linux-musl --path . +ARG TARGETARCH +ARG TARGETARCH +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + cargo install --target x86_64-unknown-linux-musl --path . ; \ + elif [ "$TARGETARCH" = "arm64" ]; then \ + cargo install --target aarch64-unknown-linux-musl --path . ; \ + else \ + echo "The architecture $TARGETARCH isn't unsupported." && exit 1; \ + fi FROM docker.io/library/alpine:latest COPY --from=builder /usr/local/cargo/bin/agate /usr/bin/agate