From af85dc7dcfd3f6d117f61b5ce0034fbfd7ae6671 Mon Sep 17 00:00:00 2001 From: Ben Aaron Goldberg Date: Mon, 25 Oct 2021 06:24:57 -0400 Subject: [PATCH 1/4] web: rename crate to up dashes instead of underscores. Signed-off-by: Ben Aaron Goldberg --- web/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Cargo.toml b/web/Cargo.toml index 8063719..4bb89e7 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pronouns_today_web" +name = "pronouns-today-web" version = "0.1.0" edition = "2021" From 45c6eb39bb84cc3703cba3530d03f688237538d3 Mon Sep 17 00:00:00 2001 From: Ben Aaron Goldberg Date: Mon, 25 Oct 2021 06:25:26 -0400 Subject: [PATCH 2/4] web: Revert back to Rust 2018 It has better compatibly and the code works as is. Signed-off-by: Ben Aaron Goldberg --- web/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/Cargo.toml b/web/Cargo.toml index 4bb89e7..4fef6ee 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pronouns-today-web" version = "0.1.0" -edition = "2021" +edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 6378adba7a1010f091cc82e328c6e0ac511b3856 Mon Sep 17 00:00:00 2001 From: Ben Aaron Goldberg Date: Mon, 25 Oct 2021 06:41:23 -0400 Subject: [PATCH 3/4] web: Added startup message Signed-off-by: Ben Aaron Goldberg --- web/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/web/src/main.rs b/web/src/main.rs index 46d4d79..097b915 100644 --- a/web/src/main.rs +++ b/web/src/main.rs @@ -98,6 +98,7 @@ async fn not_found() -> impl Responder { #[actix_web::main] async fn main() -> std::io::Result<()> { env_logger::init(); + println!("Starting pronouns-today-web on 127.0.0.1:8080"); HttpServer::new(|| { let logger = Logger::default(); App::new() From 8d8a92a0b5111211061c683f79c2416f52a1eaa4 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Mon, 25 Oct 2021 21:02:33 -0400 Subject: [PATCH 4/4] Added Docker support --- web/Dockerfile | 10 ++++++++++ web/build-docker.sh | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 web/Dockerfile create mode 100755 web/build-docker.sh diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 0000000..98b407b --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,10 @@ +FROM rust:1.56-alpine3.13 AS builder +RUN apk update +RUN apk add musl-dev +ADD . . +WORKDIR web +RUN cargo build --target=x86_64-unknown-linux-musl --release + +FROM scratch +COPY --from=builder target/x86_64-unknown-linux-musl/release/pronouns_today_web / +CMD ["/pronouns_today_web"] diff --git a/web/build-docker.sh b/web/build-docker.sh new file mode 100755 index 0000000..61e2900 --- /dev/null +++ b/web/build-docker.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker build .. -t 'pronouns_today_web' -f Dockerfile