aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2020-05-23 16:29:02 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2020-05-23 16:29:02 +0200
commit5dd4544360906de246de9e33abbfd741681d2fea (patch)
treebdb1c52d7085023a827b80f99619a747d2125b95 /Dockerfile
parent3e2ea02d62e0d8fd77e46e6dc5e0318584fb16dc (diff)
downloaddiplonat-5dd4544360906de246de9e33abbfd741681d2fea.tar.gz
diplonat-5dd4544360906de246de9e33abbfd741681d2fea.zip
Dockerize app
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile23
1 files changed, 23 insertions, 0 deletions
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"]