From 336b6a339d48b5d9ca87535d666e37e86aebd89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Fri, 9 Aug 2024 21:01:26 +0000 Subject: [PATCH] refactor: extract build variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ecdbb13..71ce865 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ +ARG TARGET=x86_64-hermit +ARG PREFIX=/opt/hermit + FROM --platform=$BUILDPLATFORM rust:bookworm AS kernel ADD --link https://github.com/hermit-os/kernel.git /kernel WORKDIR /kernel @@ -35,10 +38,13 @@ ADD --link https://github.com/hermit-os/newlib.git newlib ADD --link https://github.com/hermit-os/pthread-embedded.git pte ADD --link ./toolchain.sh ./toolchain.sh -RUN ./toolchain.sh x86_64-hermit /opt/hermit +ARG TARGET +ARG PREFIX +RUN ./toolchain.sh $TARGET $PREFIX FROM rust:bookworm AS toolchain -COPY --from=builder /opt/hermit /opt/hermit -ENV PATH=/opt/hermit/bin:$PATH \ - LD_LIBRARY_PATH=/opt/hermit/lib:$LD_LIBRARY_PATH +ARG PREFIX +COPY --from=builder $PREFIX $PREFIX +ENV PATH=$PREFIX/bin:$PATH \ + LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH