Browse Source

docker: check "/app/gogs" separately on startup (#5895)

When running gogs after the first time, if the image has changed (update
rebuild), the /app/gogs directory will have changed owner back to
root:root, but /data will likely not be since the data directories are
likely to be persistent.

Checking /app/gogs separately fixes this.
Achilleas Koutsou 5 years ago
parent
commit
91e9495148
1 changed files with 8 additions and 1 deletions
  1. 8 1
      docker/s6/gogs/setup

+ 8 - 1
docker/s6/gogs/setup

@@ -21,6 +21,13 @@ ln -sfn /data/git /home/git
 
 # Only chown for the first time, owner of '/data' is 'git' inside Docker after installation
 if [ $(stat -c '%U' /data) != 'git' ]; then
-	chown -R git:git /data /app/gogs ~git/
+    chown -R git:git /data ~git/
 fi
+
+# Check ownership of '/app/gogs' in case the image changed and '/data' is persistent
+if [ $(stat -c '%U' /app/gogs) != 'git' ]; then
+    chown -R git:git /app/gogs
+fi
+
+
 chmod 0755 /data /data/gogs ~git/