From 9886f60b048952fd38a2e0c9a5356a14535685a2 Mon Sep 17 00:00:00 2001 From: mol Date: Sun, 25 Feb 2024 05:46:21 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20entrypoint.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entrypoint.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index a2abd52..ef9c46c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,19 +30,14 @@ if [ "${DOCKER_USER-}" ]; then fi # git使用openssh的shh程序 - git config --global core.sshCommand "/usr/bin/ssh" + su "$(id -un 1000)" -c 'git config --global core.sshCommand "/usr/bin/ssh"' if [ -n "$GIT_USER" ] && [ -n "$GIT_EMAIL" ]; then - git config --global user.name "$GIT_USER" - git config --global user.email "$GIT_EMAIL" + su "$(id -un 1000)" -c 'git config --global user.name "$GIT_USER"' + su "$(id -un 1000)" -c 'git config --global user.email "$GIT_EMAIL"' echo "git 用户已设置完毕" fi - if [ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASSWD" ]; then - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWD" - echo "docker 用户登录完成" - fi - sudo chown -R "$DOCKER_USER":999 /home/coder # 移除无密码sudo sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd @@ -63,5 +58,6 @@ ssh-agent bash if [ -d "${ENTRYPOINTD}" ]; then find "${ENTRYPOINTD}" -type f -executable -print -exec {} \; fi - -su "$(id -un 1000)" -c "exec dumb-init /usr/bin/code-server $@" +RUN_CMD="exec dumb-init /usr/bin/code-server $@" +echo $RUN_CMD +su "$(id -un 1000)" -c $RUN_CMD