From 5dd4544360906de246de9e33abbfd741681d2fea Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sat, 23 May 2020 16:29:02 +0200 Subject: Dockerize app --- Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Dockerfile (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..41c7da9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM debian:bullseye-slim as builder + +RUN apt-get update && \ + apt-get install -y rustc cargo libssl-dev pkg-config + +WORKDIR /srv + +# Build dependencies and cache them +COPY Cargo.* ./ +RUN mkdir -p src && \ + echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \ + cargo build --release && \ + rm -r src && \ + rm target/release/deps/diplonat* + +# Build final app +COPY ./src ./src +RUN cargo build --release + +FROM debian:bullseye-slim +RUN apt-get update && apt-get install -y libssl1.1 +COPY --from=builder /srv/target/release/diplonat /usr/local/sbin/diplonat +CMD ["/usr/local/sbin/diplonat"] -- cgit v1.2.3