diff --git a/Containerfile.alpine b/Containerfile.alpine new file mode 100644 index 0000000..aa2275b --- /dev/null +++ b/Containerfile.alpine @@ -0,0 +1,23 @@ +FROM rust:1.76-alpine AS build + +RUN apk add clang-dev nettle-dev linux-headers +ADD . /src +WORKDIR /src +ADD <<-EOF /.cargo/config.toml + [registries.distrust] + index = "https://git.distrust.co/public/_cargo-index.git" +EOF +RUN cargo fetch +ENV NETTLE_STATIC=yes +ENV PCSC_LIB_NAME=static=pcsclite +ENV RUSTFLAGS='-C codegen-units=1 -C target-features=+crt-static' +RUN --network=none \ + cargo build \ + --frozen \ + --release \ + --features link-static \ + --target x86_64-alpine-linux-musl \ + --bin keyfork + +FROM scratch AS package +COPY --from=build keyfork/target/release/keyfork /keyfork