-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·31 lines (26 loc) · 1.56 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·31 lines (26 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Entrypoint for the bindmaster-test container.
# Sets up a usable home directory for whatever UID the container runs as,
# and initialises conda/mamba for the current shell session.
set -e
# ── Home directory ─────────────────────────────────────────────────────────────
# When running with a host UID (--user $(id -u):$(id -g)), $HOME may be /
# or unset. Give ourselves a real writable home inside the container.
if [[ ! -d "${HOME}" ]] || [[ "${HOME}" == "/" ]]; then
export HOME=/home/bindmaster-user
fi
mkdir -p "${HOME}" 2>/dev/null || { export HOME=/tmp/bindmaster-home; mkdir -p "${HOME}"; }
# ── conda init ────────────────────────────────────────────────────────────────
if [[ -f /opt/miniforge3/etc/profile.d/conda.sh ]]; then
source /opt/miniforge3/etc/profile.d/conda.sh
fi
[[ -f /opt/miniforge3/etc/profile.d/mamba.sh ]] && source /opt/miniforge3/etc/profile.d/mamba.sh
export PATH="/opt/miniforge3/bin:${HOME}/.local/bin:${PATH}"
# Ensure conda is initialised in interactive shells opened later (docker exec)
if [[ ! -f "${HOME}/.bashrc" ]]; then
cat > "${HOME}/.bashrc" <<'RCEOF'
[[ -f /opt/miniforge3/etc/profile.d/conda.sh ]] && source /opt/miniforge3/etc/profile.d/conda.sh
[[ -f /opt/miniforge3/etc/profile.d/mamba.sh ]] && source /opt/miniforge3/etc/profile.d/mamba.sh
RCEOF
fi
exec "$@"