summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-09-26 02:36:55 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-09-26 02:36:55 +0200
commitedf770e69bd379ba29ce07b614549bfb6ffa3045 (patch)
treec2437d8304c733641657bdf7b77d194bc17582a3
downloadgogs-edf770e69bd379ba29ce07b614549bfb6ffa3045.tar.gz
gogs-edf770e69bd379ba29ce07b614549bfb6ffa3045.tar.bz2
gogs-edf770e69bd379ba29ce07b614549bfb6ffa3045.tar.xz
gogs-edf770e69bd379ba29ce07b614549bfb6ffa3045.zip
Adapted for OpenShift (cron, syslog, and ssh services are not running)
-rw-r--r--Dockerfile14
-rwxr-xr-xroot/entrypoint20
-rwxr-xr-xroot/usr/bin/fix-permissions7
-rwxr-xr-xroot/usr/bin/rungogs3
4 files changed, 44 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..78ffc0f
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,14 @@
+FROM gogs/gogs:latest
+
+MAINTAINER Suren A. Chilingaryan <csa@suren.me>
+
+COPY ./root /
+
+RUN mkdir -p /data/gogs/data /data/gogs/conf /data/gogs/log /data/git /data/ssh && \
+ /usr/bin/fix-permissions /data && \
+ ln -sfn /data/gogs/log /app/gogs/log && \
+ ln -sfn /data/gogs/data /app/gogs/data && \
+ /usr/bin/fix-permissions /etc/passwd
+
+ENTRYPOINT ["/entrypoint"]
+CMD ["/usr/bin/rungogs"]
diff --git a/root/entrypoint b/root/entrypoint
new file mode 100755
index 0000000..9845a77
--- /dev/null
+++ b/root/entrypoint
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+export USER=git
+export HOME=/data
+export USER_ID=$(id -u)
+export GROUP_ID=$(id -g)
+
+grep -v ^git /etc/passwd > "$HOME/passwd"
+echo "git:x:${USER_ID}:${GROUP_ID}:gogs.io user:${HOME}:/bin/bash" >> "$HOME/passwd"
+cat "$HOME/passwd" > /etc/passwd
+
+#No nss_wrapper in Alpine Linux yet
+#export LD_PRELOAD=libnss_wrapper.so
+#export NSS_WRAPPER_PASSWD=${HOME}/passwd
+#export NSS_WRAPPER_GROUP=/etc/group
+#export PORT=3000
+
+mkdir -p /data/gogs/data /data/gogs/conf /data/gogs/log /data/git /data/ssh
+
+exec "$@"
diff --git a/root/usr/bin/fix-permissions b/root/usr/bin/fix-permissions
new file mode 100755
index 0000000..b90d208
--- /dev/null
+++ b/root/usr/bin/fix-permissions
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Fix permissions on the given directory to allow group read/write of
+# regular files and execute of directories.
+chown -R git "$1"
+chgrp -R 0 "$1"
+chmod -R g+rw "$1"
+find "$1" -type d -exec chmod g+x {} +
diff --git a/root/usr/bin/rungogs b/root/usr/bin/rungogs
new file mode 100755
index 0000000..0167152
--- /dev/null
+++ b/root/usr/bin/rungogs
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+/app/gogs/gogs web