aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docker/README.md8
-rw-r--r--docker/s6/crond/down0
-rwxr-xr-xdocker/s6/crond/run9
-rwxr-xr-xdocker/start.sh9
4 files changed, 25 insertions, 1 deletions
diff --git a/docker/README.md b/docker/README.md
index 63d4a51e..af6dfc7a 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -58,6 +58,8 @@ $ docker run --name=gogs -p 10022:22 -p 10080:3000 -v gogs-data:/data gogs/gogs
## Settings
+### Application
+
Most of settings are obvious and easy to understand, but there are some settings can be confusing by running Gogs inside Docker:
- **Repository Root Path**: keep it as default value `/home/git/gogs-repositories` because `start.sh` already made a symbolic link for you.
@@ -67,7 +69,11 @@ Most of settings are obvious and easy to understand, but there are some settings
- **HTTP Port**: Use port you want Gogs to listen on inside Docker container. For example, your Gogs listens on `3000` inside Docker, and you expose it by `10080:3000`, but you still use `3000` for this value.
- **Application URL**: Use combination of **Domain** and **exposed HTTP Port** values(e.g. `http://192.168.99.100:10080/`).
-Full documentation of settings can be found [here](http://gogs.io/docs/advanced/configuration_cheat_sheet.html).
+Full documentation of application settings can be found [here](http://gogs.io/docs/advanced/configuration_cheat_sheet.html).
+
+### Crond
+
+Please set environment variable `RUN_CROND` to be `true` or `1` in order to start `crond` inside the container.
## Upgrade
diff --git a/docker/s6/crond/down b/docker/s6/crond/down
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/docker/s6/crond/down
diff --git a/docker/s6/crond/run b/docker/s6/crond/run
new file mode 100755
index 00000000..9aa9fb9f
--- /dev/null
+++ b/docker/s6/crond/run
@@ -0,0 +1,9 @@
+#!/bin/sh
+# Crontabs are located by default in /var/spool/cron/crontabs/
+# The default configuration is also calling all the scripts in /etc/periodic/${period}
+
+if test -f ./setup; then
+ source ./setup
+fi
+
+exec gosu root /usr/sbin/crond -fS
diff --git a/docker/start.sh b/docker/start.sh
index 042bdd05..a54c2a9b 100755
--- a/docker/start.sh
+++ b/docker/start.sh
@@ -48,6 +48,15 @@ else
create_socat_links
fi
+CROND=$(echo "$RUN_CROND" | tr '[:upper:]' '[:lower:]')
+if [ "$CROND" = "true" -o "$CROND" = "1" ]; then
+ echo "init:crond | Cron Daemon (crond) will be run as requested by s6" 1>&2
+ rm -f /app/gogs/docker/s6/crond/down
+else
+ # Tell s6 not to run the crond service
+ touch /app/gogs/docker/s6/crond/down
+fi
+
# Exec CMD or S6 by default if nothing present
if [ $# -gt 0 ];then
exec "$@"