-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·27 lines (22 loc) · 974 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·27 lines (22 loc) · 974 Bytes
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
#!/bin/bash
set -e
if [ -v LOCAL_USER_ID ]; then
if id -u ${LOCAL_USER_ID} >/dev/null 2>&1; then
BASE_USER=aloception
else
# Create a new user with the specified UID and GI
useradd --home /home/aloception --uid $LOCAL_USER_ID --shell /bin/bash dynamic && usermod -aG sudo dynamic && echo "dynamic ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
BASE_USER=dynamic
fi
else
BASE_USER=aloception
fi
echo "Starting with UID : $LOCAL_USER_ID, base user: $BASE_USER"
export CONDA_HOME=/opt/miniconda;
export PATH=${CONDA_HOME}/condabin:${CONDA_HOME}/bin:${PATH};
source activate base;
if [ "$#" -ne 0 ]; then
su -s /bin/bash $BASE_USER -c "export CONDA_HOME=/opt/miniconda; export PATH=${CONDA_HOME}/condabin:${CONDA_HOME}/bin:${PATH}; source activate base; $@"
else
su -s /bin/bash $BASE_USER -c "export CONDA_HOME=/opt/miniconda; export PATH=${CONDA_HOME}/condabin:${CONDA_HOME}/bin:${PATH}; source activate base; script -q /dev/null -c 'bash -i'"
fi