From cc56b4f89ef854273fe0c33b87f94812f3b5cb71 Mon Sep 17 00:00:00 2001 From: Daniel Panteleit <15816819+danielpanteleit@users.noreply.github.com> Date: Sun, 4 Nov 2018 20:23:50 +0100 Subject: [PATCH] Calling supervisord directly instead of via shell (Closes: #1047, #1074) --- Dockerfile | 2 +- setup.sh | 2 +- target/start-mailserver.sh | 2 +- test/tests.bats | 11 ++++++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 38f30633..9a998481 100644 --- a/Dockerfile +++ b/Dockerfile @@ -219,6 +219,6 @@ COPY target/supervisor/conf.d/* /etc/supervisor/conf.d/ EXPOSE 25 587 143 465 993 110 995 4190 -CMD supervisord -c /etc/supervisor/supervisord.conf +CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] ADD target/filebeat.yml.tmpl /etc/filebeat/filebeat.yml.tmpl diff --git a/setup.sh b/setup.sh index 2abcbf3d..af69b9a9 100755 --- a/setup.sh +++ b/setup.sh @@ -7,7 +7,7 @@ INFO=$(docker ps \ --no-trunc \ --format="{{.Image}}\t{{.Names}}\t{{.Command}}" | \ - grep "/bin/sh -c 'supervisord -c /etc/supervisor/supervisord.conf'") + grep "supervisord -c /etc/supervisor/supervisord.conf") IMAGE_NAME=$(echo $INFO | awk '{print $1}') CONTAINER_NAME=$(echo $INFO | awk '{print $2}') diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 3980d329..4ccff1ec 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -389,7 +389,7 @@ function _check_hostname() { if ( ! echo $HOSTNAME | grep -E '^(\S+[.]\S+)$' > /dev/null ); then notify 'err' "Setting hostname/domainname is required" - kill -6 `cat /var/run/supervisord.pid` && return 1 + kill `cat /var/run/supervisord.pid` && return 1 else notify 'inf' "Domain has been set to $DOMAINNAME" notify 'inf' "Hostname has been set to $HOSTNAME" diff --git a/test/tests.bats b/test/tests.bats index 0c86c380..4c3f1759 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -6,7 +6,7 @@ load 'test_helper/bats-assert/load' @test "checking configuration: hostname/domainname" { run docker run `docker inspect --format '{{ .Config.Image }}' mail` - assert_failure + assert_success } @test "checking configuration: hostname/domainname override" { @@ -1785,3 +1785,12 @@ load 'test_helper/bats-assert/load' run docker exec mail grep "Subject: Root Test Message" /var/mail/localhost.localdomain/user1/new/ -R assert_success } + +# +# clean exit +# + +@test "checking that the container stops cleanly" { + run docker stop -t 60 mail + assert_success +}