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 <william@kulian.org>
This commit is contained in:
William Blew 2023-05-20 01:59:57 +00:00
parent 4c9806d71c
commit c96a2301a8
No known key found for this signature in database
GPG Key ID: 685F01B0E0D4A2C7
1 changed files with 1 additions and 1 deletions

View File

@ -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