diff --git a/Dockerfile b/Dockerfile index b5dbc268..ae91bdd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,6 +83,8 @@ ARG LINUX_VER=notset ARG PYTHON_VER=notset ARG DEBIAN_FRONTEND=noninteractive ENV PATH=/opt/conda/bin:$PATH +# ensure conda's files and configuration can be found at runtime even if environment activation was bypassed +ENV CONDA_PREFIX=/opt/conda ENV PYTHON_VERSION=${PYTHON_VER} SHELL ["/bin/bash", "-euo", "pipefail", "-c"] diff --git a/context/entrypoint.sh b/context/entrypoint.sh index 991cbead..78ee50bf 100755 --- a/context/entrypoint.sh +++ b/context/entrypoint.sh @@ -1,5 +1,5 @@ -#!/usr/bin/env bash -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +#!/usr/bin/env -S bash -l +# Copyright (c) 2023-2026, NVIDIA CORPORATION. set -eo pipefail @@ -10,6 +10,9 @@ https://developer.download.nvidia.com/licenses/NVIDIA_Deep_Learning_Container_Li EOF +# Activate conda (login shell sources from /etc/profile.d/conda.sh) +conda activate + if [ -e "/home/rapids/environment.yml" ]; then echo "environment.yml found. Installing packages." timeout ${CONDA_TIMEOUT:-600} mamba env update -n base -y -f /home/rapids/environment.yml || exit $? diff --git a/tests/container-canary/base.yml b/tests/container-canary/base.yml index 644f0d07..1f79cfc1 100644 --- a/tests/container-canary/base.yml +++ b/tests/container-canary/base.yml @@ -124,3 +124,11 @@ checks: - /bin/bash - -c - "[[ $(conda env list --quiet | grep --count -E '^[A-Za-z]+') == 1 ]];" + - name: conda-prefix + description: Conda prefix set to /opt/conda + probe: + exec: + command: + - /bin/bash + - -c + - '[[ "${CONDA_PREFIX}" == "/opt/conda" ]];'