summaryrefslogtreecommitdiff
path: root/images/runit-edge
diff options
context:
space:
mode:
authorSystem administrator2017-05-29 13:26:10 +0200
committerSystem administrator2017-05-29 13:26:10 +0200
commitbc5c44dd049bad3b007be48b3f8d90886d63c105 (patch)
treea381d989db2295f228f9bc95a774f0cc9aef4c40 /images/runit-edge
downloadserver-bc5c44dd049bad3b007be48b3f8d90886d63c105.tar.gz
server-bc5c44dd049bad3b007be48b3f8d90886d63c105.tar.xz
server-bc5c44dd049bad3b007be48b3f8d90886d63c105.zip
Initial commit
Diffstat (limited to 'images/runit-edge')
-rw-r--r--images/runit-edge/Dockerfile14
-rw-r--r--images/runit-edge/runit/run17
2 files changed, 31 insertions, 0 deletions
diff --git a/images/runit-edge/Dockerfile b/images/runit-edge/Dockerfile
new file mode 100644
index 0000000..d0c2040
--- /dev/null
+++ b/images/runit-edge/Dockerfile
@@ -0,0 +1,14 @@
+FROM alpine:edge
+
+RUN apk add --no-cache sudo shadow runit
+
+# runit
+ADD runit/run /app/runit/run
+ONBUILD ADD service /etc/service
+# Make sure all service and log files are executable
+ONBUILD RUN find -L /etc/service \( -name run -or -name finish -or -name down \) -exec chmod +x {} \;
+
+# If supplied as "ENTRYPOINT foo" it will be wrapped in "/bin/sh -c",
+# but that will swallow signals and we rely on those
+ONBUILD RUN chmod +x /app/runit/run
+ONBUILD ENTRYPOINT ["/app/runit/run"]
diff --git a/images/runit-edge/runit/run b/images/runit-edge/runit/run
new file mode 100644
index 0000000..c3861c2
--- /dev/null
+++ b/images/runit-edge/runit/run
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+echo "Found services:"
+find /etc/service -mindepth 1 -maxdepth 1
+
+/sbin/runsvdir /etc/service &
+runsvdir_pid=$!
+echo "Started runit as $runsvdir_pid"
+
+runit_stop() {
+ echo "Stopping runit"
+ # "If runsvdir receives HUP, it sends TERM to each runsv process"
+ kill -HUP $runsvdir_pid
+}
+
+trap "runit_stop" SIGTERM
+wait