Skip to content

Commit

Permalink
Fix docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 1, 2024
1 parent ecf053b commit 416d7bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ fn main() -> Result<()> {
println!("cargo::rustc-check-cfg=cfg(icons_out_dir)");
println!("cargo:rustc-cfg=icons_out_dir");

let package_dir = env::var("CARGO_MANIFEST_DIR").context("missing CARGO_MANIFEST_DIR")?;
let package_dir = Path::new(&package_dir);
generate_css_icons(package_dir.join("static/icons.css"), out_dir)?;
let out_css = "static/icons.css";
let out_css = if std::env::var("RUN_IN_DOCKER").is_ok() {
let _ = std::fs::create_dir_all("/srv/docsrs/static");
Path::new("/srv/docsrs/").join(out_css)
} else {
let package_dir = env::var("CARGO_MANIFEST_DIR").context("missing CARGO_MANIFEST_DIR")?;
Path::new(&package_dir).join(out_css)
};
generate_css_icons(out_css, out_dir)?;

// trigger recompilation when a new migration is added
println!("cargo:rerun-if-changed=migrations");
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ COPY assets assets/
COPY .sqlx .sqlx/
COPY migrations migrations/

ENV RUN_IN_DOCKER="1"
RUN cargo build --profile=$PROFILE

######################
Expand Down

0 comments on commit 416d7bc

Please sign in to comment.