Source
FROM stagex/pallet-rust AS build
ARG VERSION
ADD fetch/guestctl-${VERSION}.tar.gz .
WORKDIR /guestctl
ADD <<-EOF /.cargo/config.toml
[registries.distrust]
index = "https://git.distrust.co/public/_cargo-index.git"
EOF
RUN cargo fetch
ENV RUST_BACKTRACE=1
RUN --network=none <<-EOF
set -eux
ARCH="$(uname -m)"
cargo build \
--frozen \
--release \
--target "${ARCH}-unknown-linux-musl" \
--no-default-features \
--bin guestctl
mkdir -p /rootfs/usr/bin
cp target/${ARCH}-unknown-linux-musl/release/guestctl /rootfs/usr/bin/guestctl
EOF
FROM stagex/core-filesystem AS package
COPY --from=build /rootfs/ /