Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions runscripts/container/Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ From: ghcr.io/astral-sh/uv@sha256:cda8422643a3d47dd5d457639dce8f5fbd130ef158ff4a
export IMAGE_GIT_HASH="{{ git_hash }}"
export IMAGE_GIT_BRANCH="{{ git_branch }}"
export IMAGE_TIMESTAMP="{{ timestamp }}"
export UV_CACHE_DIR="/vEcoli/.uv_cache"
# Silence warning about cache and sync targets being on different filesystems
export UV_LINK_MODE="copy"
# Prevent uv dirs from being created in any locations that may overlap with
# host filesystems that Apptainer may automount
export UV_TOOL_DIR="/vEcoli/.uv_tools"
export UV_TOOL_BIN_DIR="/vEcoli/.uv_tools/bin"
export UV_PYTHON_INSTALL_DIR="/vEcoli/.uv_python"
export UV_PYTHON_BIN_DIR="/vEcoli/.uv_python/bin"
# Source shared uv environment variables
. /vEcoli/singularity-env.sh
# runscripts/container/build-image.sh has some custom logic to replace this
# with the environment variables that are set in .env
{{ dot_env_vars }}
Expand All @@ -31,6 +24,7 @@ From: ghcr.io/astral-sh/uv@sha256:cda8422643a3d47dd5d457639dce8f5fbd130ef158ff4a

%files
repo.tar /repo.tar
runscripts/container/singularity-env.sh /vEcoli/singularity-env.sh

%post
mkdir -p /vEcoli
Expand All @@ -40,12 +34,6 @@ From: ghcr.io/astral-sh/uv@sha256:cda8422643a3d47dd5d457639dce8f5fbd130ef158ff4a
fi
apt-get update && apt-get install -y gcc procps nano curl
cd /vEcoli
# Silence warning about cache and sync targets being on different filesystems
export UV_LINK_MODE="copy"
# Prevent uv dirs from being created in any locations that may overlap with
# host filesystems that Apptainer may automount
export UV_TOOL_DIR="/vEcoli/.uv_tools"
export UV_TOOL_BIN_DIR="/vEcoli/.uv_tools/bin"
export UV_PYTHON_INSTALL_DIR="/vEcoli/.uv_python"
export UV_PYTHON_BIN_DIR="/vEcoli/.uv_python/bin"
UV_CACHE_DIR="/vEcoli/.uv_cache" UV_COMPILE_BYTECODE=1 uv sync --frozen
# Source shared uv environment variables
. /vEcoli/singularity-env.sh
UV_COMPILE_BYTECODE=1 uv sync --frozen
Copy link
Contributor Author

@thalassemia thalassemia Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiling bytecode is recommended at image build time to improve container startup time. Once the container is started, Nextflow does not modify the code or install additional packages, so there is no point in leaving it on. If end users choose to modify code or install additional packages inside an interactive container, the latency added by bytecode recompilation is probably negligible.

13 changes: 13 additions & 0 deletions runscripts/container/singularity-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Shared environment variables for Singularity build and runtime

# Silence warning about cache and sync targets being on different filesystems
export UV_LINK_MODE="copy"

# Prevent uv dirs from being created in any locations that may overlap with
# host filesystems that Apptainer may automount
export UV_TOOL_DIR="/vEcoli/.uv_tools"
export UV_TOOL_BIN_DIR="/vEcoli/.uv_tools/bin"
export UV_PYTHON_INSTALL_DIR="/vEcoli/.uv_python"
export UV_PYTHON_BIN_DIR="/vEcoli/.uv_python/bin"
export UV_CACHE_DIR="/vEcoli/.uv_cache"