summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile26
1 files changed, 26 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..c1354eb
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,26 @@
+# Based on https://alexbrand.dev/post/how-to-package-rust-applications-into-minimal-docker-containers/
+FROM rust:1.57.0 AS build
+
+MAINTAINER Jesse Morgan <jesse@jesterpm.net>
+
+WORKDIR /usr/src
+
+# Build the dependencies first
+# This should help repeated builds go faster.
+RUN USER=root cargo new flowerpot
+WORKDIR /usr/src/flowerpot
+COPY Cargo.toml Cargo.lock ./
+RUN cargo build --release
+
+# Copy the source and build the application.
+COPY src ./src
+RUN cargo install --path .
+
+# Now build the deployment image.
+FROM debian:stable-slim
+# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y libssl1.1 ca-certificates sqlite3
+COPY --from=build /usr/local/cargo/bin/flowerpot .
+COPY www ./www
+USER 999
+CMD ["./flowerpot"]