add static route for main.css
Some checks failed
Build and publish the docker image / build (push) Failing after 10s
Some checks failed
Build and publish the docker image / build (push) Failing after 10s
Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
parent
f4dd0995a7
commit
314b237bb7
16
Dockerfile
16
Dockerfile
@ -15,11 +15,17 @@ RUN cargo build --release
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN useradd -ms /bin/bash -u 1001 libmedium
|
||||
RUN apt-get update && apt-get install -y ca-certificates
|
||||
RUN mkdir /var/lib/libmedium && chown libmedium /var/lib/libmedium
|
||||
RUN useradd -d /app -u 1001 -g 1001 libmedium
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y ca-certificates
|
||||
|
||||
COPY --from=rust /src/target/release/libmedium /usr/local/bin/
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=rust /src/target/release/libmedium ./
|
||||
COPY --from=rust /src/config.toml ./
|
||||
COPY --from=rust /src/static ./static
|
||||
|
||||
RUN chown libmedium:libmedium -R /app
|
||||
|
||||
USER libmedium
|
||||
ENTRYPOINT ["/usr/local/bin/libmedium"]
|
||||
ENTRYPOINT ["/app/libmedium"]
|
||||
|
2
build.rs
2
build.rs
@ -23,5 +23,5 @@ fn main() {
|
||||
.expect("error in git command, is git installed?");
|
||||
let git_hash = String::from_utf8(output.stdout).unwrap();
|
||||
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
|
||||
println!("cargo:rerun-if-changed=src/schema2.graphql,templates/main.css");
|
||||
println!("cargo:rerun-if-changed=src/schema2.graphql,static/main.css");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
debug = true
|
||||
#cache = "/var/lib/libmedium"
|
||||
#cache = "/cache"
|
||||
port = 7000
|
||||
ip= "0.0.0.0"
|
||||
domain = "example.com"
|
||||
|
@ -20,6 +20,7 @@ use actix_web::{
|
||||
error::InternalError, http::StatusCode, middleware as actix_middleware, web::JsonConfig, App,
|
||||
HttpServer,
|
||||
};
|
||||
use actix_files as fs;
|
||||
use lazy_static::lazy_static;
|
||||
use log::info;
|
||||
|
||||
@ -66,6 +67,7 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.service(fs::Files::new("/static", "./static"))
|
||||
.wrap(actix_middleware::Logger::default())
|
||||
.wrap(actix_middleware::Compress::default())
|
||||
.app_data(get_json_err())
|
||||
|
@ -40,16 +40,10 @@ impl Settings {
|
||||
let mut s = Config::builder();
|
||||
|
||||
// setting default values
|
||||
const CURRENT_DIR: &str = "./config.toml";
|
||||
const ETC: &str = "/etc/libmedium/config.toml";
|
||||
|
||||
if let Ok(path) = env::var("LIBMEDIUM") {
|
||||
s = s.add_source(File::with_name(&path));
|
||||
} else if Path::new(CURRENT_DIR).exists() {
|
||||
// merging default config from file
|
||||
s = s.add_source(File::with_name(CURRENT_DIR));
|
||||
} else if Path::new(ETC).exists() {
|
||||
s = s.add_source(File::with_name(ETC));
|
||||
} else if Path::new("./config.toml").exists() {
|
||||
s = s.add_source(File::with_name("./config.toml");
|
||||
} else {
|
||||
log::warn!("configuration file not found");
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/static/main.css">
|
||||
<title>LibMedium</title>
|
||||
</head>
|
||||
<body>
|
||||
@ -30,7 +31,4 @@
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
<style>
|
||||
<. include!("./main.css"); .>
|
||||
</style>
|
||||
</html>
|
||||
|
@ -29,7 +29,4 @@
|
||||
</article>
|
||||
</main>
|
||||
</body>
|
||||
<style>
|
||||
<. include!("./main.css"); .>
|
||||
</style>
|
||||
</html>
|
||||
|
@ -74,3 +74,4 @@
|
||||
rel="canonical"
|
||||
href="http://<.= &*crate::SETTINGS.domain .>/<.= data.creator.name .>/<.= data.unique_slug .>"
|
||||
/>
|
||||
<link rel="stylesheet" href="/static/main.css">
|
||||
|
Loading…
x
Reference in New Issue
Block a user