put micromamba in /usr/local/bin
instead of tmp, since we want it to stick around.
MODIFY
repo2docker/buildpacks/conda/__init__.py
repo2docker/buildpacks/conda/__init__.py
@@ -56,7 +56,7 @@ class CondaBuildPack(BaseImage):
("NPM_CONFIG_GLOBALCONFIG", "${NPM_DIR}/npmrc"),
("NB_ENVIRONMENT_FILE", self._nb_environment_file),
("MAMBA_ROOT_PREFIX", "${CONDA_DIR}"),
- ("MAMBA_EXE", "/tmp/bin/micromamba"),
+ ("MAMBA_EXE", "/usr/local/bin/micromamba"),
]
if self._nb_requirements_file:
env.append(("NB_REQUIREMENTS_FILE", self._nb_requirements_file))

MODIFY
repo2docker/buildpacks/conda/activate-conda.sh
repo2docker/buildpacks/conda/activate-conda.sh
# enable conda and activate the notebook environment
-/tmp/bin/micromamba shell init -s bash -p ${CONDA_DIR}
+micromamba shell init -s bash -p ${CONDA_DIR}
export MAMBA_ROOT_PREFIX="/srv/conda"
CONDA_PROFILE="${CONDA_DIR}/etc/profile.d/mamba.sh"
test -f $CONDA_PROFILE && . $CONDA_PROFILE

MODIFY
repo2docker/buildpacks/conda/install-base-env.bash
repo2docker/buildpacks/conda/install-base-env.bash
@@ -15,13 +15,14 @@ URL="https://anaconda.org/conda-forge/micromamba/${MAMBA_VERSION}/download/linux
unset HOME
mkdir -p ${CONDA_DIR}
-time wget -qO- ${URL} | tar -xvj bin/micromamba
-chmod 0755 /tmp/bin/micromamba
-
export MAMBA_ROOT_PREFIX=${CONDA_DIR}
-export MAMBA_EXE="/tmp/bin/micromamba"
+export MAMBA_EXE="/usr/local/bin/micromamba"
+
+time wget -qO- ${URL} | tar -xvj bin/micromamba
+mv bin/micromamba "$MAMBA_EXE"
+chmod 0755 "$MAMBA_EXE"
-eval "$(/tmp/bin/micromamba shell hook -p ${CONDA_DIR} -s posix)"
+eval "$(${MAMBA_EXE} shell hook -p ${CONDA_DIR} -s posix)"
micromamba activate

MODIFY
tests/conda/binder-dir/verify
tests/conda/binder-dir/verify
@@ -4,7 +4,7 @@ from subprocess import check_output
assert sys.version_info[:2] == (3, 5), sys.version
-out = check_output(["/tmp/bin/micromamba", "--version"]).decode("utf8").strip()
+out = check_output(["micromamba", "--version"]).decode("utf8").strip()
assert (
out
== """micromamba: 0.19.1

MODIFY
tests/conda/simple-py2/verify
tests/conda/simple-py2/verify
@@ -14,17 +14,13 @@ assert sorted(specs) == ["python2", "python3"], specs.keys()
import json
from subprocess import check_output
-envs = json.loads(
- check_output(["/tmp/bin/micromamba", "env", "list", "--json"]).decode("utf8")
-)
+envs = json.loads(check_output(["micromamba", "env", "list", "--json"]).decode("utf8"))
assert envs == {
"envs": ["/srv/conda", "/srv/conda/envs/kernel", "/srv/conda/envs/notebook"]
}, envs
pkgs = json.loads(
- check_output(["/tmp/bin/micromamba", "list", "-n", "kernel", "--json"]).decode(
- "utf8"
- )
+ check_output(["micromamba", "list", "-n", "kernel", "--json"]).decode("utf8")
)
pkg_names = [pkg["name"] for pkg in pkgs]
assert "ipykernel" in pkg_names, pkg_names

put micromamba in /usr/local/bin

instead of tmp, since we want it to stick around.