From a7b303dce2028836d0e9602abb6f6968091a56a0 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sat, 25 Nov 2023 14:09:52 +0100 Subject: [PATCH] add dockerfile --- .dockerignore | 4 ++++ Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..633cc84 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +README.md +LICENSE.txt +/dist +/target \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c0f751c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM public.ecr.aws/docker/library/rust:1-alpine as builder + +RUN rustup default stable +RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconf git + +# Set `SYSROOT` to a dummy path (default is /usr) because pkg-config-rs *always* +# links those located in that path dynamically but we want static linking, c.f. +# https://github.com/rust-lang/pkg-config-rs/blob/54325785816695df031cef3b26b6a9a203bbc01b/src/lib.rs#L613 +ENV SYSROOT=/dummy + +WORKDIR /wd +COPY . /wd +RUN cargo build --release --target=x86_64-unknown-linux-musl + +FROM public.ecr.aws/docker/library/alpine +ARG version=unknown +ARG release=unreleased + +COPY --from=builder /wd/target/x86_64-unknown-linux-musl/release/staxman /usr/local/bin/ +CMD ["staxman"] \ No newline at end of file