forked from works-on-my-machine/pytorch-code-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·36 lines (29 loc) · 1.07 KB
/
entrypoint.sh
File metadata and controls
executable file
·36 lines (29 loc) · 1.07 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
32
33
34
35
36
#!/bin/sh
set -eu
# We do this first to ensure sudo works below when renaming the user.
# Otherwise the current container UID may not exist in the passwd database.
eval "$(fixuid -q)"
if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
# nor can we bind mount $HOME into a new home as that requires a privileged container.
sudo usermod --login "$DOCKER_USER" coder
sudo groupmod -n "$DOCKER_USER" coder
USER="$DOCKER_USER"
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
fi
EXTENSIONS="${EXTENSIONS:-none}"
if [ ${EXTENSIONS} != "none" ]
then
echo "Installing Extensions"
for extension in $(echo ${EXTENSIONS} | tr "," "\n")
do
if [ "${extension}" != "" ]
then
dumb-init /usr/bin/code-server \
--install-extension "${extension}" \
/home/coder
fi
done
fi
dumb-init /usr/bin/code-server "$@"