index : sfrs

A Standard Notes Sync Server written in Rust

diff options
context:
space:
mode:
authorPeter Cai <[email protected]>2020-02-24 03:29:19 +0000
committerPeter Cai <[email protected]>2020-02-24 03:29:19 +0000
commitc4e489da563ef88b5e888b166c765f86cfc83848 (patch)
treefac42a51bf2ecb45e20c25fa25514780762d515d
parent31acab5e9db158bdbb98f8d39d1c3b83e0295515 (diff)
downloadsfrs-c4e489da563ef88b5e888b166c765f86cfc83848.tar.gz
add dockerfile
-rw-r--r--docker/Dockerfile28
1 files changed, 28 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..620aa0b
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,28 @@
+# Build the application
+FROM docker.io/debian:9-slim as builder
+
+ENV RUSTUP_HOME=/usr/local/rustup \
+ CARGO_HOME=/usr/local/cargo \
+ PATH=/usr/local/cargo/bin:$PATH
+
+RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev curl ca-certificates gcc
+
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /rustup-init.sh
+
+RUN sh /rustup-init.sh -y --no-modify-path --default-toolchain nightly
+
+COPY . /sfrs
+
+RUN cd /sfrs && cargo build --release && cp target/release/sfrs /usr/local/bin/
+
+# Build the main image
+FROM docker.io/debian:9-slim
+
+RUN apt-get update && apt-get install -y sqlite3
+
+COPY --from=builder /usr/local/bin/sfrs /usr/local/bin/sfrs
+
+VOLUME ["/data"]
+WORKDIR /data
+EXPOSE 8000/tcp
+ENTRYPOINT ["/usr/local/bin/sfrs"]