forked from conda-forge/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint
executable file
·30 lines (25 loc) · 1.09 KB
/
entrypoint
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
#!/bin/bash -il
# Use non-interactive cp
unalias cp
# Create conda user with the same uid as the host, so the container can write
# to mounted volumes
# Adapted from https://denibertovic.com/posts/handling-permissions-with-docker-volumes/
USER_ID=${HOST_USER_ID:-9001}
useradd --shell /bin/bash -u $USER_ID -G lucky -o -c "" -m conda
export HOME=/home/conda
export USER=conda
export LOGNAME=conda
export MAIL=/var/spool/mail/conda
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/conda/bin
export supkg="su-exec"
chown conda:conda $HOME
cp -R /etc/skel $HOME && chown -R conda:conda $HOME/skel && (ls -A1 $HOME/skel | xargs -I {} mv -n $HOME/skel/{} $HOME) && rm -Rf $HOME/skel
# This is needed to have a predictable channel specification used for builds
# from non-conda-forge channels as conda-smithy does not remove it for us.
rm -f /opt/conda/.condarc
cp /root/.condarc $HOME/.condarc && chown conda:conda $HOME/.condarc
cd $HOME
# Source everything that needs to be.
. /opt/docker/bin/entrypoint_source
# Run whatever the user wants.
exec /opt/conda/bin/$supkg conda "$@"