From 63b8b78ee82abca47c8f37a2e8d96a3d01c663a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Thu, 6 Jan 2022 14:32:20 +0300 Subject: [PATCH] chore: Add Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Dockerfile has been added (along with .dockerignore) to build a lightweight image of `rathole`. Image is being built using `rust-musl-builder` and `scratch` is used for runtime. Signed-off-by: Orhun Parmaksız --- .dockerignore | 12 ++++++++++++ Dockerfile | 12 ++++++++++++ 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..2748718 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +# Directories +/.git/ +/.github/ +/target/ +/examples/ +/docs/ +/benches/ + +# Files +.gitignore +*.md +LICENSE diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..433f589 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM ekidd/rust-musl-builder:latest as builder +WORKDIR /home/rust/src +COPY . . +RUN cargo build --locked --release +RUN mkdir -p build-out/ +RUN cp target/x86_64-unknown-linux-musl/release/rathole build-out/ + +FROM scratch +WORKDIR /app +COPY --from=builder /home/rust/src/build-out/rathole . +USER 1000:1000 +ENTRYPOINT ["./rathole"]