diff --git a/ci/src/main.rs b/ci/src/main.rs index 5f7abe3..db4dd14 100644 --- a/ci/src/main.rs +++ b/ci/src/main.rs @@ -1,13 +1,12 @@ use cuddle_ci::{Context, MainAction, PullRequestAction}; -use dagger_sdk::{ - Container, HostDirectoryOptsBuilder, PortForward, QueryContainerOptsBuilder, - ServiceUpOptsBuilder, -}; +use dagger_sdk::{Container, HostDirectoryOptsBuilder, PortForward, ServiceUpOptsBuilder}; const UPDATE_DEPLOYMENT_IMAGE: &str = "docker.io/kasperhermansen/update-deployment:1690401410"; -const ZOLA_VERSION: &str = "0.17.2-1"; -const DEBIAN_EDITION: &str = "bullseye"; +const CADDY_IMAGE: &str = "caddy:v2.10.0"; + +const ZOLA_VERSION: &str = "0.21.0"; +const DEBIAN_EDITION: &str = "bookworm"; const DEBIAN_PLATFORM: &str = "amd64"; #[derive(Clone)] @@ -72,8 +71,8 @@ async fn build(client: dagger_sdk::Query) -> eyre::Result<(i64, Container)> { .container() .from("node:16") .with_workdir("/app") - .with_directory(".", src.id().await?) - .with_mounted_cache("node_modules", node_cache.id().await?) + .with_directory(".", src.clone()) + .with_mounted_cache("node_modules", node_cache) .with_exec(vec!["yarn"]) .with_exec(vec!["yarn", "compile"]) .file("static/styles/styles.css"); @@ -90,7 +89,7 @@ async fn build(client: dagger_sdk::Query) -> eyre::Result<(i64, Container)> { .with_exec(vec!["apt", "update"]) .with_exec(vec!["apt", "install", "wget", "-y"]) .with_workdir("/mnt") - .with_mounted_cache("/mnt", debian_cache.id().await?) + .with_mounted_cache("/mnt", debian_cache) .with_exec(vec!["wget", &github_zola_download]) .with_exec(vec![ "dpkg", @@ -98,18 +97,18 @@ async fn build(client: dagger_sdk::Query) -> eyre::Result<(i64, Container)> { format!("zola_{ZOLA_VERSION}_{DEBIAN_PLATFORM}_{DEBIAN_EDITION}.deb").as_str(), ]) .with_workdir("/app") - .with_directory(".", src.id().await?) - .with_file("static/styles/styles.css", styles_file.id().await?) + .with_directory(".", src) + .with_file("static/styles/styles.css", styles_file) .with_exec(vec!["zola", "build"]) .directory("public"); let caddy_file = client.host().directory("deployment").file("Caddyfile"); let dep_image = client - .container_opts(QueryContainerOptsBuilder::default().build().unwrap()) - .from("caddy") - .with_directory("/usr/share/caddy", dist_dir.id().await.unwrap()) - .with_file("/etc/caddy/Caddyfile", caddy_file.id().await.unwrap()); + .container() + .from(CADDY_IMAGE) + .with_directory("/usr/share/caddy", dist_dir) + .with_file("/etc/caddy/Caddyfile", caddy_file); Ok((tag, dep_image)) } diff --git a/deployment/Caddyfile b/deployment/Caddyfile index 9cf2d06..d0c20d0 100644 --- a/deployment/Caddyfile +++ b/deployment/Caddyfile @@ -5,4 +5,5 @@ http://blog.kasperhermansen.com { root * /usr/share/caddy file_server + encode gzip } diff --git a/mise.toml b/mise.toml index 8ee954e..eb6b887 100644 --- a/mise.toml +++ b/mise.toml @@ -3,7 +3,7 @@ dir = "./ci" run = "cargo build" [tasks."ci:run"] -run = "./ci/target/debug/ci" +run = "./target/debug/ci" [tasks."ci:main"] depends = ["ci:build"]