From 3bffcccb2317977dbdf293e6bfb134fa73aa20fe Mon Sep 17 00:00:00 2001 From: Will Holtz Date: Mon, 28 Aug 2023 08:31:44 -0700 Subject: [PATCH 1/2] fix: use "base" if $ENV_NAME is not set --- _activate_current_env.sh | 6 +++--- test/examples.bats | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/_activate_current_env.sh b/_activate_current_env.sh index 44850f9..5c4efa8 100755 --- a/_activate_current_env.sh +++ b/_activate_current_env.sh @@ -30,6 +30,6 @@ if [[ "${MAMBA_SKIP_ACTIVATE}" == "1" ]]; then fi # For robustness, try all possible activate commands. -conda activate "${ENV_NAME}" 2>/dev/null \ - || mamba activate "${ENV_NAME}" 2>/dev/null \ - || micromamba activate "${ENV_NAME}" +conda activate "${ENV_NAME:-base}" 2>/dev/null \ + || mamba activate "${ENV_NAME:-base}" 2>/dev/null \ + || micromamba activate "${ENV_NAME:-base}" diff --git a/test/examples.bats b/test/examples.bats index a201991..d4b394e 100644 --- a/test/examples.bats +++ b/test/examples.bats @@ -20,6 +20,8 @@ test_example() { @test "examples/add_micromamba" { test_example add_micromamba + run docker run --rm "${MICROMAMBA_IMAGE}-add_micromamba" jq --version + assert_success } @test "examples/apt_install" { From 9f488dce0bd6a18184205bd1eb342d5c1e9158d4 Mon Sep 17 00:00:00 2001 From: Will Holtz Date: Mon, 28 Aug 2023 08:34:24 -0700 Subject: [PATCH 2/2] docs: example add_micromaba to use new UID/GID --- examples/add_micromamba/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/add_micromamba/Dockerfile b/examples/add_micromamba/Dockerfile index de37190..07542a8 100644 --- a/examples/add_micromamba/Dockerfile +++ b/examples/add_micromamba/Dockerfile @@ -9,9 +9,9 @@ USER root # if your image defaults to a non-root user, then you may want to make the # next 3 ARG commands match the values in your image. You can get the values # by running: docker run --rm -it my/image id -a -ARG MAMBA_USER=mamba -ARG MAMBA_USER_ID=1000 -ARG MAMBA_USER_GID=1000 +ARG MAMBA_USER=mambauser +ARG MAMBA_USER_ID=57439 +ARG MAMBA_USER_GID=57439 ENV MAMBA_USER=$MAMBA_USER ENV MAMBA_ROOT_PREFIX="/opt/conda" ENV MAMBA_EXE="/bin/micromamba"