From 2cbb54c483ddebc86aab7b35dd0d9bf405a6b67a Mon Sep 17 00:00:00 2001 From: Ada Werefox Date: Thu, 30 Mar 2023 22:08:41 +0000 Subject: [PATCH] Make a Dockerfile to enable running the app in a container. --- Dockerfile | 20 ++++++++++++++++++++ Rocket.toml | 33 +++++++++++++++++++++++++++++++++ build.rs | 7 ------- docker-compose.yml | 10 ++++++++++ 4 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 Dockerfile create mode 100644 Rocket.toml create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d5cff1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM rust:alpine + +WORKDIR /usr/src/app + +RUN apk add git musl-dev npm && \ + npm install tailwindcss + +COPY build.rs . +COPY Cargo.lock . +COPY Cargo.toml . +COPY public/ public/ +COPY Rocket.toml . +COPY src/ src/ +COPY tailwind.config.js . +COPY templates/ templates/ + +RUN mkdir target +RUN cargo install --config "net.git-fetch-with-cli=true" --path . + +CMD ["rust-letter"] diff --git a/Rocket.toml b/Rocket.toml new file mode 100644 index 0000000..d762efc --- /dev/null +++ b/Rocket.toml @@ -0,0 +1,33 @@ +[default] +address = "0.0.0.0" +# workers = 16 +# max_blocking = 512 +# keep_alive = 5 +ident = "rust-letter-werefox-cafe" +# ip_header = "X-Real-IP" # set to `false` to disable +# log_level = "normal" +# temp_dir = "/tmp" +# cli_colors = true + +[debug] +port = 8234 + +[release] +port = 3469 +secret_key = "yqXUwxWOGD6X7yZaMbRnOXsNjiDMicveyC2imK48KbM=" + +# [default.limits] +# form = "64 kB" +# json = "1 MiB" +# msgpack = "2 MiB" +# "file/jpg" = "5 MiB" + +# [default.tls] +# certs = "path/to/cert-chain.pem" +# key = "path/to/key.pem" + +# [default.shutdown] +# ctrlc = true +# signals = ["term", "hup"] +# grace = 5 +# mercy = 5 diff --git a/build.rs b/build.rs index d23236b..46daf68 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,5 @@ fn main() { let mut tailwind = std::process::Command::new("npx"); - // tailwind.args([ - // "-c", - // "tailwind.config.js", - // "-o", - // "src/index.css", - // "--minify", - // ]); tailwind.args( "tailwindcss -i src/index.css -c tailwind.config.js -o public/styles/tailwind.min.css --minify" .split(" "), diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..abfbac3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +--- +version: "3" + +services: + "rust-letter-werefox-cafe": + image: rust-letter-werefox-cafe:latest + build: + context: . + ports: + - "3469:3469"