更新 entrypoint.sh
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
@ -10,14 +10,15 @@ set -eu
|
||||
# 初始化
|
||||
if [ "${DOCKER_USER-}" ]; then
|
||||
USER="$DOCKER_USER"
|
||||
if [ "$DOCKER_USER" != "$(id -un 1000)" ]; then
|
||||
USER_HOME="$(id -un 1000)"
|
||||
if [ "$DOCKER_USER" != "$USER_HOME" ]; then
|
||||
# 无密码sudo
|
||||
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" "$(id -un 1000)"
|
||||
sudo groupmod -n "$DOCKER_USER" "$(id -un 1000)"
|
||||
sudo usermod --login "$DOCKER_USER" "$USER_HOME"
|
||||
sudo groupmod -n "$DOCKER_USER" "$USER_HOME"
|
||||
|
||||
sudo chown -R "$DOCKER_USER":999 /home/coder
|
||||
|
||||
|
Reference in New Issue
Block a user