summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/.dockerignore1
-rw-r--r--docker/Dockerfile11
-rw-r--r--docker/assets/gitlab.rb (renamed from docker/gitlab.rb)0
-rwxr-xr-xdocker/assets/wrapper17
4 files changed, 25 insertions, 4 deletions
diff --git a/docker/.dockerignore b/docker/.dockerignore
new file mode 100644
index 00000000000..dd449725e18
--- /dev/null
+++ b/docker/.dockerignore
@@ -0,0 +1 @@
+*.md
diff --git a/docker/Dockerfile b/docker/Dockerfile
index cfb89357a67..3a0a55e18e3 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -26,9 +26,12 @@ RUN mkdir -p /opt/gitlab/sv/sshd/supervise \
# Expose web & ssh
EXPOSE 80 22
-# Volume & configuration
+# Declare volumes
VOLUME ["/var/opt/gitlab", "/var/log/gitlab", "/etc/gitlab"]
-ADD gitlab.rb /etc/gitlab/
-# Default is to run runit & reconfigure
-CMD gitlab-ctl reconfigure & /opt/gitlab/embedded/bin/runsvdir-start \ No newline at end of file
+# Copy assets
+COPY assets/gitlab.rb /etc/gitlab/
+COPY assets/wrapper /usr/local/bin/
+
+# Wrapper to handle signal, trigger runit and reconfigure GitLab
+CMD ["/usr/local/bin/wrapper"]
diff --git a/docker/gitlab.rb b/docker/assets/gitlab.rb
index 7fddf309c01..7fddf309c01 100644
--- a/docker/gitlab.rb
+++ b/docker/assets/gitlab.rb
diff --git a/docker/assets/wrapper b/docker/assets/wrapper
new file mode 100755
index 00000000000..9e6e7a05903
--- /dev/null
+++ b/docker/assets/wrapper
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+function sigterm_handler() {
+ echo "SIGTERM signal received, try to gracefully shutdown all services..."
+ gitlab-ctl stop
+}
+
+trap "sigterm_handler; exit" TERM
+
+function entrypoint() {
+ # Default is to run runit and reconfigure GitLab
+ gitlab-ctl reconfigure &
+ /opt/gitlab/embedded/bin/runsvdir-start &
+ wait
+}
+
+entrypoint