From abbb1b6c442705743cc44aa2b3f31b6fa54303bd Mon Sep 17 00:00:00 2001 From: Justine Pelletreau Date: Fri, 13 Jan 2023 17:24:30 +0100 Subject: [PATCH] =?UTF-8?q?Dockerfile=20p=C3=A9t=C3=A9,=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 ++++++++ README.md | 4 ++++ Cargo.lock => flog/Cargo.lock | 0 Cargo.toml => flog/Cargo.toml | 4 ++++ {html => flog/html}/footer.html | 0 {html => flog/html}/header.html | 0 {html => flog/html}/index.html | 0 {html => flog/html}/main.css | 0 {html => flog/html}/pages/1-firstpage.html | 0 {html => flog/html}/pages/2-secondpage.html | 0 .../html}/pages/3-A_very_different_page.html | 0 {html => flog/html}/pics/ferris.png | Bin {html => flog/html}/pics/happy-ferris.png | Bin {src => flog/src}/main.rs | 4 ++-- {templates => flog/templates}/index.html.ft | 0 .../templates}/pages/1-firstpage.html.ft | 0 .../templates}/pages/2-secondpage.html.ft | 0 .../pages/3-A_very_different_page.html.ft | 0 {templates => flog/templates}/pagetemplate.html.ft | 0 19 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Dockerfile rename Cargo.lock => flog/Cargo.lock (100%) rename Cargo.toml => flog/Cargo.toml (86%) rename {html => flog/html}/footer.html (100%) rename {html => flog/html}/header.html (100%) rename {html => flog/html}/index.html (100%) rename {html => flog/html}/main.css (100%) rename {html => flog/html}/pages/1-firstpage.html (100%) rename {html => flog/html}/pages/2-secondpage.html (100%) rename {html => flog/html}/pages/3-A_very_different_page.html (100%) rename {html => flog/html}/pics/ferris.png (100%) rename {html => flog/html}/pics/happy-ferris.png (100%) rename {src => flog/src}/main.rs (97%) rename {templates => flog/templates}/index.html.ft (100%) rename {templates => flog/templates}/pages/1-firstpage.html.ft (100%) rename {templates => flog/templates}/pages/2-secondpage.html.ft (100%) rename {templates => flog/templates}/pages/3-A_very_different_page.html.ft (100%) rename {templates => flog/templates}/pagetemplate.html.ft (100%) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32028cd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM rust:1.66.0-alpine3.17 +COPY ./flog /opt/flog +WORKDIR /opt/flog +VOLUME ["/opt/flog/html"] +VOLUME ["/opt/flog/templates"] +RUN apk add build-base make bash +RUN cargo build +EXPOSE 80 diff --git a/README.md b/README.md index 1127934..58b5bd5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # Flog A simple blog engine based on Flair and SSW. +# TODO +* Pass the directory location as environment vars +* A Dockerfile that works + ![](sshot.png) diff --git a/Cargo.lock b/flog/Cargo.lock similarity index 100% rename from Cargo.lock rename to flog/Cargo.lock diff --git a/Cargo.toml b/flog/Cargo.toml similarity index 86% rename from Cargo.toml rename to flog/Cargo.toml index e319b2f..228f7ec 100644 --- a/Cargo.toml +++ b/flog/Cargo.toml @@ -5,6 +5,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[bin]] +name = "flog" +path = "src/main.rs" + [dependencies] flair = { git = "https://gitea.squi.fr/Rust/flair.git" } ssw = { git = "https://gitea.squi.fr/Rust/ssw.git" } diff --git a/html/footer.html b/flog/html/footer.html similarity index 100% rename from html/footer.html rename to flog/html/footer.html diff --git a/html/header.html b/flog/html/header.html similarity index 100% rename from html/header.html rename to flog/html/header.html diff --git a/html/index.html b/flog/html/index.html similarity index 100% rename from html/index.html rename to flog/html/index.html diff --git a/html/main.css b/flog/html/main.css similarity index 100% rename from html/main.css rename to flog/html/main.css diff --git a/html/pages/1-firstpage.html b/flog/html/pages/1-firstpage.html similarity index 100% rename from html/pages/1-firstpage.html rename to flog/html/pages/1-firstpage.html diff --git a/html/pages/2-secondpage.html b/flog/html/pages/2-secondpage.html similarity index 100% rename from html/pages/2-secondpage.html rename to flog/html/pages/2-secondpage.html diff --git a/html/pages/3-A_very_different_page.html b/flog/html/pages/3-A_very_different_page.html similarity index 100% rename from html/pages/3-A_very_different_page.html rename to flog/html/pages/3-A_very_different_page.html diff --git a/html/pics/ferris.png b/flog/html/pics/ferris.png similarity index 100% rename from html/pics/ferris.png rename to flog/html/pics/ferris.png diff --git a/html/pics/happy-ferris.png b/flog/html/pics/happy-ferris.png similarity index 100% rename from html/pics/happy-ferris.png rename to flog/html/pics/happy-ferris.png diff --git a/src/main.rs b/flog/src/main.rs similarity index 97% rename from src/main.rs rename to flog/src/main.rs index 6c84ea4..33c0fed 100644 --- a/src/main.rs +++ b/flog/src/main.rs @@ -98,8 +98,8 @@ fn main() { //Web conf let webconf = WebsrvConfig { - nbr_of_threads: 3, - bind_addr: String::from("0.0.0.0:8080"), + nbr_of_threads: 10, + bind_addr: String::from("0.0.0.0:80"), root_folder: String::from("./html"), }; start_websrv(webconf); diff --git a/templates/index.html.ft b/flog/templates/index.html.ft similarity index 100% rename from templates/index.html.ft rename to flog/templates/index.html.ft diff --git a/templates/pages/1-firstpage.html.ft b/flog/templates/pages/1-firstpage.html.ft similarity index 100% rename from templates/pages/1-firstpage.html.ft rename to flog/templates/pages/1-firstpage.html.ft diff --git a/templates/pages/2-secondpage.html.ft b/flog/templates/pages/2-secondpage.html.ft similarity index 100% rename from templates/pages/2-secondpage.html.ft rename to flog/templates/pages/2-secondpage.html.ft diff --git a/templates/pages/3-A_very_different_page.html.ft b/flog/templates/pages/3-A_very_different_page.html.ft similarity index 100% rename from templates/pages/3-A_very_different_page.html.ft rename to flog/templates/pages/3-A_very_different_page.html.ft diff --git a/templates/pagetemplate.html.ft b/flog/templates/pagetemplate.html.ft similarity index 100% rename from templates/pagetemplate.html.ft rename to flog/templates/pagetemplate.html.ft