aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-01-03 19:31:07 +0100
committerAlex Auvolat <alex@adnab.me>2023-01-03 19:31:18 +0100
commita0e276a6297706459e79a4ea76f1e69e6520f08b (patch)
treeb32cfe6fa252fa6f519438ad6a97183c6aca931b /Dockerfile
parent45651ed313d4ae2437738a20660ba71110e2f13d (diff)
downloadD53-a0e276a6297706459e79a4ea76f1e69e6520f08b.tar.gz
D53-a0e276a6297706459e79a4ea76f1e69e6520f08b.zip
Add files to produce Docker container
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..b49a4a7
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,23 @@
+FROM rust:1.65-buster as builder
+
+RUN apt-get update && \
+ apt-get install -y 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/d53*
+
+# Build final app
+COPY ./src ./src
+RUN cargo build --release
+
+FROM debian:bullseye-slim
+RUN apt-get update && apt-get install -y libssl1.1 iptables ca-certificates
+COPY --from=builder /srv/target/release/d53 /usr/local/sbin/d53
+CMD ["/usr/local/sbin/d53"]