This commit is contained in:
JMARyA 2024-09-16 13:49:44 +02:00
parent e0d2a5876d
commit d8ffb7cf75
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
5 changed files with 35 additions and 6 deletions

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM rust:buster as builder
COPY . /app
WORKDIR /app
RUN cargo build --release
FROM debian:buster
RUN apt update && apt upgrade -y
COPY ./src/extract_metadata.py /extract_metadata.py
COPY --from=builder /app/target/release/umbrella /umbrella
WORKDIR /
CMD ["/umbrella"]

10
docker-compose.yml Normal file
View file

@ -0,0 +1,10 @@
version: '3'
services:
umbrella:
build: .
ports:
- "8000:8000"
volumes:
- ./config.yml:/config.yml
environment:
ROCKET_ADDRESS: 0.0.0.0

View file

@ -44,7 +44,6 @@ impl Config {
impl Project {
pub fn build(&self, card_id: &str) -> maud::PreEscaped<String> {
let subcard_id = format!("{card_id}_sub");
// todo : info
maud::html!(
div class="card" id=(card_id) {
@ -62,7 +61,9 @@ impl Project {
@if let Some(contact) = &self.contact {
(contact.build())
}
@if self.sub.as_ref().map(|x| !x.is_empty()).unwrap_or(false) {
button class="expand-button" onclick=(format!("toggleSubcards('{subcard_id}')")) { "Expand" };
}
div class="subcards" id=(subcard_id) {
@if let Some(sub) = &self.sub {
@for (id, prj) in sub {

View file

@ -1,12 +1,13 @@
use config::Config;
use rocket::response::content::RawHtml;
use rocket::{get, launch, routes, State};
mod config;
mod site;
#[get("/")]
pub fn main_page(c: &State<Config>) -> String {
site::gen_site(c)
pub fn main_page(c: &State<Config>) -> RawHtml<String> {
RawHtml(site::gen_site(c))
}
#[launch]

View file

@ -9,10 +9,10 @@ pub fn gen_site(c: &Config) -> String {
meta name="viewport" content="width=device-width, initial-scale=1.0";
title { "Umbrella ☂️"};
link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css";
style { (include_str!("style.css")) };
style { (maud::PreEscaped(include_str!("style.css"))) };
};
body {
script { (include_str!("script.js")) };
script { (maud::PreEscaped(include_str!("script.js"))) };
main class="container" {
h1 { "Umbrella ☂️" };