Fix UID/GID handling in user git

master
rohhie 2023-05-01 18:49:06 +09:00
parent 82063a0bac
commit 6f12e54f9c
2 changed files with 7 additions and 3 deletions

View File

@ -129,13 +129,17 @@ secho 5
echo "================================================" echo "================================================"
echo " ユーザーgitの作成" echo " ユーザーgitの作成"
echo "================================================" echo "================================================"
sudo useradd -u 1997 -m git sudo useradd -m git
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "処理を中止します" echo "処理を中止します"
exit exit
fi fi
echo "=== UID/GIDの書き換え"
sed -i "s/\(- USER_UID=\)[[:digit:]]\+/\1$(id -u git)/" docker/docker-compose.yml
sed -i "s/\(- USER_GID=\)[[:digit:]]\+/\1$(id -g git)/" docker/docker-compose.yml
echo "=== gitの証明書の作成" echo "=== gitの証明書の作成"
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key" -f /home/git/.ssh/id_rsa sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key" -f /home/git/.ssh/id_rsa
sudo -u git cp /home/git/.ssh/id_rsa.pub /home/git/.ssh/authorized_keys sudo -u git cp /home/git/.ssh/id_rsa.pub /home/git/.ssh/authorized_keys

View File

@ -45,8 +45,8 @@ services:
image: custom/gitea image: custom/gitea
container_name: gitea container_name: gitea
environment: environment:
- USER_UID=1997 - USER_UID=1000
- USER_GID=1997 - USER_GID=1000
- GITEA__database__DB_TYPE=mysql - GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=db:3306 - GITEA__database__HOST=db:3306
- GITEA__database__NAME=gitea - GITEA__database__NAME=gitea