Sfoglia il codice sorgente

chore: Add Dockerfile

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 <orhunparmaksiz@gmail.com>
Orhun Parmaksız 4 anni fa
parent
commit
63b8b78ee8
2 ha cambiato i file con 24 aggiunte e 0 eliminazioni
  1. 12 0
      .dockerignore
  2. 12 0
      Dockerfile

+ 12 - 0
.dockerignore

@@ -0,0 +1,12 @@
+# Directories
+/.git/
+/.github/
+/target/
+/examples/
+/docs/
+/benches/
+
+# Files
+.gitignore
+*.md
+LICENSE

+ 12 - 0
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"]