mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-18 15:00:18 +00:00
26 lines
1.2 KiB
Docker
26 lines
1.2 KiB
Docker
# syntax=docker/dockerfile:1.7-labs
|
|
ARG RUST_PROFILE=release
|
|
ARG RUST_TARGET_SUBDIR=release
|
|
|
|
FROM --platform=$BUILDPLATFORM rust:1.91.1-alpine@sha256:fbcca3e30e26f79986809d5dbfcdbeaaf8d3f8a4475b7a19a973363b45c74d97 AS build
|
|
RUN apk --no-cache add musl-dev busybox-static
|
|
ARG RUST_PROFILE
|
|
RUN adduser -S -s /bin/sh build
|
|
COPY \
|
|
--exclude=rust-toolchain.toml \
|
|
--exclude=hack \
|
|
--chown=build:build \
|
|
. /build
|
|
WORKDIR /build
|
|
ARG TARGETPLATFORM
|
|
ARG RUST_TARGET_SUBDIR
|
|
RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ] || [ "${TARGETPLATFORM}" = "linux/x86_64" ]; then \
|
|
rustup target add x86_64-unknown-uefi; cargo build --bin sprout --profile "${RUST_PROFILE}" --target x86_64-unknown-uefi && \
|
|
cp "target/x86_64-unknown-uefi/${RUST_TARGET_SUBDIR}/sprout.efi" /sprout.efi; fi
|
|
RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ] || [ "${TARGETPLATFORM}" = "linux/aarch64" ]; then \
|
|
rustup target add aarch64-unknown-uefi; cargo build --bin sprout --profile "${RUST_PROFILE}" --target aarch64-unknown-uefi && \
|
|
cp "target/aarch64-unknown-uefi/${RUST_TARGET_SUBDIR}/sprout.efi" /sprout.efi; fi
|
|
|
|
FROM scratch AS final
|
|
COPY --from=build /sprout.efi /sprout.efi
|