From 54ca5520b745ecb4cd9a1ae17c7bce7a39a6c4f5 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 2 Jan 2024 12:41:34 -0800 Subject: [PATCH] containerfile --- Containerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Containerfile diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..216b638 --- /dev/null +++ b/Containerfile @@ -0,0 +1,23 @@ +# Using the `rust-musl-builder` as base image, instead of +# the official Rust toolchain +FROM clux/muslrust:stable AS chef +USER root +RUN cargo install cargo-chef +WORKDIR /app + +FROM chef AS planner +COPY . . +RUN cargo chef prepare --recipe-path recipe.json + +FROM chef AS builder +COPY --from=planner /app/recipe.json recipe.json +# Notice that we are specifying the --target flag! +RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json +COPY . . +RUN cargo build --release --target x86_64-unknown-linux-musl --bin asset-tool + +FROM alpine AS runtime +RUN addgroup -S myuser && adduser -S myuser -G myuser +COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/asset-tool /usr/local/bin/ +USER myuser +CMD ["/usr/local/bin/asset-tool"] \ No newline at end of file