aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Bengtsson <hb@aroma-project.org>2017-11-04 19:40:31 -0700
committerLunny Xiao <xiaolunwen@gmail.com>2017-11-05 10:40:31 +0800
commit9bdce5d21b8897f09de01f69c3f81def2d2ceccb (patch)
tree0c9b7c8d979235f681ae0683ef62e18cf7fa8982
parentbe523152a819f6edfb1a257f5cebcb36fc96fc14 (diff)
downloadgitea-9bdce5d21b8897f09de01f69c3f81def2d2ceccb.tar.gz
gitea-9bdce5d21b8897f09de01f69c3f81def2d2ceccb.zip
Launch Gitea with custom UID/GID for 'git' user (fixes #2286) (#2791)
-rwxr-xr-xdocker/usr/bin/entrypoint11
1 files changed, 11 insertions, 0 deletions
diff --git a/docker/usr/bin/entrypoint b/docker/usr/bin/entrypoint
index a450d20607..b374c5aed7 100755
--- a/docker/usr/bin/entrypoint
+++ b/docker/usr/bin/entrypoint
@@ -1,5 +1,16 @@
#!/bin/sh
+## Change GID for USER?
+if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
+ sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
+ sed -i -e "s/^${USER}:\([^:]*\):\([0-9]*\):[0-9]*/${USER}:\1:\2:${USER_GID}/" /etc/passwd
+fi
+
+## Change UID for USER?
+if [ -n "${USER_UID}" ] && [ "${USER_UID}" != "`id -u ${USER}`" ]; then
+ sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:\([0-9]*\)/${USER}:\1:${USER_UID}:\2/" /etc/passwd
+fi
+
for FOLDER in /data/gitea/conf /data/gitea/log /data/git /data/ssh; do
mkdir -p ${FOLDER}
done