From c96a2301a8934cd51d1a47c3dd9b74e34079ea25 Mon Sep 17 00:00:00 2001 From: William Blew Date: Sat, 20 May 2023 01:59:57 +0000 Subject: [PATCH] FIX the GITEA_RUNNER_GID envar, 2nd attempt Another attempt to fix the GITEA_RUNNER_GID envar issue. See https://github.com/vegardit/docker-gitea-act-runner/issues/5 Tested this GITEA_RUNNER_GID envar fix without building the upstream image, as that was problematic to achieve locally. The fixed image requires either compose: 'user:root' OR restart: always (or unless-stopped). Why? The UID change in /opt/run.sh fails the first time, at its next sudo command. Basically: changing the running UID's /etc/passwd entry causes the next sudo command to fail. The container restart (without wiping the read/write layer) starts with the already changed /etc/passwd, and then continues without the sudo error. Signed-off-by: William Blew --- image/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/run.sh b/image/run.sh index ac702f7..4087c82 100644 --- a/image/run.sh +++ b/image/run.sh @@ -42,7 +42,7 @@ if [ -n "${GITEA_RUNNER_GID:-}" ]; then effective_gid=$(id -g act) if [ "$GITEA_RUNNER_GID" != "$effective_gid" ]; then log INFO "Changing GID of user [act] from $effective_gid to $GITEA_RUNNER_GID..." - sudo usermod -o -g "$GITEA_RUNNER_GID" act + sudo groupmod -o -g "$GITEA_RUNNER_GID" act fi fi sudo chown -R act:act /data