From 7f60f8fd3d330eaa26c17bd78a85fb4f23e912d3 Mon Sep 17 00:00:00 2001 From: Stefan Schwarz Date: Fri, 21 Aug 2020 23:43:42 +0200 Subject: [PATCH] docker --- .dockerignore | 2 ++ Cargo.toml | 3 ++- Dockerfile | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ac1b94d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/target +Dockerfile diff --git a/Cargo.toml b/Cargo.toml index 07f8152..48c13c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,9 @@ async-sqlx-session = "0.2" async-std = { version = "1.6", features = ["attributes"] } chrono = "0.4" http-types = "2.4" +openssl = { version = "0.10.30", features = ["vendored"] } serde = "1.0" -sqlx = { version = "0.4.0-beta.1", features = ["mysql", "chrono", "macros"] } +sqlx = { version = "0.4.0-beta.1", features = ["mysql", "chrono"] } tide = "0.13" [patch.crates-io] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c47f5f3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM rust as builder + +WORKDIR /app +ADD . . +RUN apt update && apt install -y musl-tools +RUN rustup target add x86_64-unknown-linux-musl +RUN cargo build --release --target x86_64-unknown-linux-musl +RUN strip /app/target/release/macnickenson + +# --- + +FROM debian:buster-slim +COPY --from=builder /app/target/release/macnickenson /opt/macnickenson +CMD /opt/macnickenson