aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore2
-rw-r--r--Dockerfile23
2 files changed, 25 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..d913617
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+target
+
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"]