From cec12749a9c948e7dd90b2da675b33a02303026f Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Tue, 5 Mar 2024 01:45:33 -0800 Subject: [PATCH] initial stagex building example --- Containerfile | 37 +++++++++++++++++++++++++++++++++++++ Makefile | 5 ++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Containerfile diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..23ef438 --- /dev/null +++ b/Containerfile @@ -0,0 +1,37 @@ +FROM scratch AS base + +FROM base AS fetch +COPY --from=stagex/rust . / +COPY --from=stagex/busybox . / +COPY --from=stagex/musl . / +COPY --from=stagex/gcc . / +COPY --from=stagex/llvm . / +COPY --from=stagex/libunwind . / +COPY --from=stagex/openssl . / +COPY --from=stagex/zlib . / +COPY --from=stagex/ca-certificates . / +ADD . /src +WORKDIR /src +RUN cargo fetch + +FROM fetch AS build +COPY --from=stagex/clang . / +COPY --from=stagex/linux-headers . / +COPY --from=stagex/gmp . / +COPY --from=stagex/nettle . / +COPY --from=stagex/pcsc-lite . / +COPY --from=stagex/pkgconf . / +COPY --from=stagex/binutils . / +ENV NETTLE_STATIC=yes +ENV PCSC_LIB_NAME=static=pcsclite +ENV RUSTFLAGS='-C codegen-units=1' +RUN --network=none \ + cargo build \ + --frozen \ + --release \ + --features static \ + --target x86_64-unknown-linux-musl \ + --bin keyfork + +FROM scratch AS install +COPY --from=build keyfork/target/release/keyfork /keyfork diff --git a/Makefile b/Makefile index efe5bd0..f31b1cb 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY: default -default: docs/book +default: out/keyfork docs/book BASE_REF ?= main HEAD_REF ?= HEAD @@ -13,6 +13,9 @@ define clone-repo test `git -C $(1) rev-parse HEAD` = $(3) endef +out/keyfork: Cargo.toml Cargo.lock crates $(shell git ls-files crates) + docker build --progress=plain --output out/ -f Containerfile . + docs/book: docs/src/links.md $(shell find docs/src -type f -name '*.md') mdbook build docs mkdir -p docs/book/rustdoc