Skip to content

Commit b491e06

Browse files
Merge 1aed545 into 014d746
2 parents 014d746 + 1aed545 commit b491e06

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

ci/release-image/entrypoint.sh

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ set -eu
55
# Otherwise the current container UID may not exist in the passwd database.
66
eval "$(fixuid -q)"
77

8-
if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then
9-
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd >/dev/null
10-
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
11-
# nor can we bind mount $HOME into a new home as that requires a privileged container.
12-
sudo usermod --login "$DOCKER_USER" coder
13-
sudo groupmod -n "$DOCKER_USER" coder
14-
8+
if [ "${DOCKER_USER-}" ]; then
159
USER="$DOCKER_USER"
10+
if [ "$DOCKER_USER" != "$(whoami)" ]; then
11+
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd >/dev/null
12+
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
13+
# nor can we bind mount $HOME into a new home as that requires a privileged container.
14+
sudo usermod --login "$DOCKER_USER" coder
15+
sudo groupmod -n "$DOCKER_USER" coder
1616

17-
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
17+
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
18+
fi
1819
fi
1920

2021
dumb-init /usr/bin/code-server "$@"

0 commit comments

Comments
 (0)