-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
31 lines (23 loc) · 997 Bytes
/
entrypoint.sh
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/sh
echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate wradlib" >> /etc/skel/.bashrc
echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate wradlib" >> ~/.bashrc
# add wradlib user
USER_ID=${LOCAL_USER_ID:-9001}
GROUP_ID=${LOCAL_GROUP_ID:-100}
USER_NAME=${LOCAL_USER_NAME:-wradlib}
echo "Container USER_ID : ${USER_ID}"
echo "Container GROUP_ID : ${GROUP_ID}"
echo "Container USER_NAME : ${USER_NAME}"
useradd -s /bin/bash -m -u ${USER_ID} -g ${GROUP_ID} ${USER_NAME}
# chown home directory
export HOME=/home/${USER_NAME}
mkdir ${HOME}/.jupyter
echo "c.MultiKernelManager.default_kernel_name = 'wradlib'" >> ${HOME}/.jupyter/jupyter_notebook_config.py
chown -R ${USER_NAME}:${GROUP_ID} ${HOME}
chown -R ${USER_NAME}:${GROUP_ID} ${CONDA_DIR}
# use su-exec to run the process as wradlib
# use script to start specific commands
if [[ "$1" != '/bin/bash' ]]; then
exec su-exec "${USER_NAME}" "/usr/local/bin/start_docker.sh" "$@"
fi
exec su-exec ${USER_NAME} "$@"