From c3257697b54169736b5110d2bec27741579c2fea Mon Sep 17 00:00:00 2001 From: Jake Runzer Date: Thu, 28 Sep 2023 19:05:54 -0400 Subject: [PATCH 1/2] fix glibc error --- examples/apt-ffmpeg/nixpacks.toml | 14 +++++++++++ .../builder/docker/dockerfile_generation.rs | 2 +- tests/docker_run_tests.rs | 8 ++++++ .../generate_plan_tests__apt_ffmpeg.snap | 25 +++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 examples/apt-ffmpeg/nixpacks.toml create mode 100644 tests/snapshots/generate_plan_tests__apt_ffmpeg.snap diff --git a/examples/apt-ffmpeg/nixpacks.toml b/examples/apt-ffmpeg/nixpacks.toml new file mode 100644 index 000000000..34b97ba86 --- /dev/null +++ b/examples/apt-ffmpeg/nixpacks.toml @@ -0,0 +1,14 @@ +[phases.setup] +aptPkgs = [ + "...", + "ffmpeg", + "imagemagick", + "ghostscript", + "gsfonts", + "fonts-droid-fallback", + "fonts-noto-mono", + "fonts-urw-base35", +] + +[start] +cmd = "ffmpeg 2>&1" diff --git a/src/nixpacks/builder/docker/dockerfile_generation.rs b/src/nixpacks/builder/docker/dockerfile_generation.rs index 3f97f5bb9..0a9026218 100644 --- a/src/nixpacks/builder/docker/dockerfile_generation.rs +++ b/src/nixpacks/builder/docker/dockerfile_generation.rs @@ -135,7 +135,7 @@ impl DockerfileGenerator for BuildPlan { String::new() } else { format!( - "RUN apt-get update && apt-get install -y --no-install-recommends {}", + "RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends {}", apt_pkgs.join(" ") ) }; diff --git a/tests/docker_run_tests.rs b/tests/docker_run_tests.rs index 1da667deb..34b581428 100644 --- a/tests/docker_run_tests.rs +++ b/tests/docker_run_tests.rs @@ -1166,3 +1166,11 @@ async fn test_nested_directory() { let name = simple_build("./examples/nested").await; assert!(run_image(&name, None).await.contains("Nested directories!")); } + +#[tokio::test] +async fn test_ffmpeg() { + let name = simple_build("./examples/apt-ffmpeg").await; + let output = run_image(&name, None).await; + println!("OUTPUT: {}", output); + assert!(output.contains("ffmpeg version")); +} diff --git a/tests/snapshots/generate_plan_tests__apt_ffmpeg.snap b/tests/snapshots/generate_plan_tests__apt_ffmpeg.snap new file mode 100644 index 000000000..3a8f07a89 --- /dev/null +++ b/tests/snapshots/generate_plan_tests__apt_ffmpeg.snap @@ -0,0 +1,25 @@ +--- +source: tests/generate_plan_tests.rs +expression: plan +--- +{ + "providers": [], + "buildImage": "[build_image]", + "phases": { + "setup": { + "name": "setup", + "aptPkgs": [ + "ffmpeg", + "imagemagick", + "ghostscript", + "gsfonts", + "fonts-droid-fallback", + "fonts-noto-mono", + "fonts-urw-base35" + ] + } + }, + "start": { + "cmd": "ffmpeg 2>&1" + } +} From 4e5eb1e0e2f9bc9313ceeba1ff724a0c3ed3261d Mon Sep 17 00:00:00 2001 From: Jake Runzer Date: Thu, 28 Sep 2023 19:24:04 -0400 Subject: [PATCH 2/2] remove println --- tests/docker_run_tests.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/docker_run_tests.rs b/tests/docker_run_tests.rs index 34b581428..42dc78c6a 100644 --- a/tests/docker_run_tests.rs +++ b/tests/docker_run_tests.rs @@ -1171,6 +1171,5 @@ async fn test_nested_directory() { async fn test_ffmpeg() { let name = simple_build("./examples/apt-ffmpeg").await; let output = run_image(&name, None).await; - println!("OUTPUT: {}", output); assert!(output.contains("ffmpeg version")); }