From b0cb3aebad159977745ed336ea8cb0800872e22e Mon Sep 17 00:00:00 2001 From: munishchouhan Date: Wed, 28 Jan 2026 14:20:30 +0100 Subject: [PATCH] added USER in pixi template Signed-off-by: munishchouhan --- .../conda-pixi-v1/dockerfile-conda-file.txt | 4 ++++ .../wave/util/ContainerHelperTest.groovy | 20 +++++++++++++------ .../seqera/wave/util/TemplateUtilsTest.groovy | 12 +++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/main/resources/templates/conda-pixi-v1/dockerfile-conda-file.txt b/src/main/resources/templates/conda-pixi-v1/dockerfile-conda-file.txt index d98f2bea0..8ccdce3d8 100644 --- a/src/main/resources/templates/conda-pixi-v1/dockerfile-conda-file.txt +++ b/src/main/resources/templates/conda-pixi-v1/dockerfile-conda-file.txt @@ -17,6 +17,10 @@ FROM {{base_image}} AS final COPY --from=build /opt/wave/.pixi/envs/default /opt/wave/.pixi/envs/default COPY --from=build /shell-hook.sh /shell-hook.sh +# set user and environment variables for Python compatibility +USER root +ENV USER=root + # set the entrypoint to the shell-hook script (activate the environment and run the command) # no more pixi needed in the final container ENTRYPOINT ["/bin/bash", "/shell-hook.sh"] diff --git a/src/test/groovy/io/seqera/wave/util/ContainerHelperTest.groovy b/src/test/groovy/io/seqera/wave/util/ContainerHelperTest.groovy index 78a596ce8..642028a1e 100644 --- a/src/test/groovy/io/seqera/wave/util/ContainerHelperTest.groovy +++ b/src/test/groovy/io/seqera/wave/util/ContainerHelperTest.groovy @@ -646,6 +646,10 @@ class ContainerHelperTest extends Specification { COPY --from=build /opt/wave/.pixi/envs/default /opt/wave/.pixi/envs/default COPY --from=build /shell-hook.sh /shell-hook.sh + # set user and environment variables for Python compatibility + USER root + ENV USER=root + # set the entrypoint to the shell-hook script (activate the environment and run the command) # no more pixi needed in the final container ENTRYPOINT ["/bin/bash", "/shell-hook.sh"] @@ -676,10 +680,10 @@ class ContainerHelperTest extends Specification { then: result =='''\ FROM ghcr.io/prefix-dev/pixi:0.47.0-jammy-cuda-12.8.1 AS build - + COPY conda.yml /opt/wave/conda.yml WORKDIR /opt/wave - + RUN pixi init --import /opt/wave/conda.yml \\ && pixi add foo::one bar::two \\ && pixi shell-hook > /shell-hook.sh \\ @@ -687,17 +691,21 @@ class ContainerHelperTest extends Specification { && echo ">> CONDA_LOCK_START" \\ && cat /opt/wave/pixi.lock \\ && echo "<< CONDA_LOCK_END" - + FROM base/image AS final - + # copy the pixi environment in the final container COPY --from=build /opt/wave/.pixi/envs/default /opt/wave/.pixi/envs/default COPY --from=build /shell-hook.sh /shell-hook.sh - + + # set user and environment variables for Python compatibility + USER root + ENV USER=root + # set the entrypoint to the shell-hook script (activate the environment and run the command) # no more pixi needed in the final container ENTRYPOINT ["/bin/bash", "/shell-hook.sh"] - + # Default command for "docker run" CMD ["/bin/bash"] '''.stripIndent() diff --git a/src/test/groovy/io/seqera/wave/util/TemplateUtilsTest.groovy b/src/test/groovy/io/seqera/wave/util/TemplateUtilsTest.groovy index 78bc606df..f20453bdd 100644 --- a/src/test/groovy/io/seqera/wave/util/TemplateUtilsTest.groovy +++ b/src/test/groovy/io/seqera/wave/util/TemplateUtilsTest.groovy @@ -371,6 +371,10 @@ class TemplateUtilsTest extends Specification { COPY --from=build /opt/wave/.pixi/envs/default /opt/wave/.pixi/envs/default COPY --from=build /shell-hook.sh /shell-hook.sh + # set user and environment variables for Python compatibility + USER root + ENV USER=root + # set the entrypoint to the shell-hook script (activate the environment and run the command) # no more pixi needed in the final container ENTRYPOINT ["/bin/bash", "/shell-hook.sh"] @@ -402,6 +406,10 @@ class TemplateUtilsTest extends Specification { COPY --from=build /opt/wave/.pixi/envs/default /opt/wave/.pixi/envs/default COPY --from=build /shell-hook.sh /shell-hook.sh + # set user and environment variables for Python compatibility + USER root + ENV USER=root + # set the entrypoint to the shell-hook script (activate the environment and run the command) # no more pixi needed in the final container ENTRYPOINT ["/bin/bash", "/shell-hook.sh"] @@ -436,6 +444,10 @@ class TemplateUtilsTest extends Specification { COPY --from=build /opt/wave/.pixi/envs/default /opt/wave/.pixi/envs/default COPY --from=build /shell-hook.sh /shell-hook.sh + # set user and environment variables for Python compatibility + USER root + ENV USER=root + # set the entrypoint to the shell-hook script (activate the environment and run the command) # no more pixi needed in the final container ENTRYPOINT ["/bin/bash", "/shell-hook.sh"]