diff options
author | eightpigs <eightpigs@outlook.com> | 2020-04-07 15:12:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-07 15:12:08 +0800 |
commit | f3b05961aae82fa3e19c47f03c78974cf793fda3 (patch) | |
tree | 237f047bab60575cdc54c7286920f6656f840647 /docker/start.sh | |
parent | 4ebdcb719a348be072b1b032d74aa6aee1b1554f (diff) |
docker: fix the bug of using root account to create `/data/*` directory (#6068)
* Fix the bug of using root account to create /data directory
* Fix the bug that sshkey cannot be added in the container and remove unnecessary chown.
Diffstat (limited to 'docker/start.sh')
-rwxr-xr-x | docker/start.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docker/start.sh b/docker/start.sh index 9f9d40e9..15f82609 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -33,16 +33,17 @@ create_volume_subfolder() { # Create VOLUME subfolder for f in /data/gogs/data /data/gogs/conf /data/gogs/log /data/git /data/ssh; do if ! test -d $f; then - mkdir -p $f + exec gosu $USER mkdir -p $f fi done } setids() { + export USER=git PUID=${PUID:-1000} PGID=${PGID:-1000} - groupmod -o -g "$PGID" git - usermod -o -u "$PUID" git + groupmod -o -g "$PGID" $USER + usermod -o -u "$PUID" $USER } setids |