diff options
author | Peter Cai <[email protected]> | 2020-02-24 03:29:19 +0000 |
---|---|---|
committer | Peter Cai <[email protected]> | 2020-02-24 03:29:19 +0000 |
commit | c4e489da563ef88b5e888b166c765f86cfc83848 (patch) | |
tree | fac42a51bf2ecb45e20c25fa25514780762d515d | |
parent | 31acab5e9db158bdbb98f8d39d1c3b83e0295515 (diff) | |
download | sfrs-c4e489da563ef88b5e888b166c765f86cfc83848.tar.gz |
add dockerfile
-rw-r--r-- | docker/Dockerfile | 28 |
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"] |