Allow starting of the container without clamav

Setting the `DISABLE_CLAMAV=1` env var will start this container without
starting clamav.
This commit is contained in:
Kyle Ondy 2016-08-04 13:08:35 -04:00
parent 60e5e42908
commit b33609d357
No known key found for this signature in database
GPG Key ID: 8D6B17000513440D
3 changed files with 15 additions and 2 deletions

View File

@ -60,6 +60,12 @@ run:
-v "`pwd`/test":/tmp/docker-mailserver-test \
-e DISABLE_SPAMASSASSIN=1 \
-h mail.my-domain.com -t $(NAME)
sleep 20
docker run -d --name mail_disabled_clamav \
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test":/tmp/docker-mailserver-test \
-e DISABLE_CLAMAV=1 \
-h mail.my-domain.com -t $(NAME)
# Wait for containers to fully start
sleep 20
@ -89,4 +95,4 @@ tests:
clean:
# Remove running test containers
docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis mail_disabled_spamassassin
docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis mail_disabled_spamassassin mail_disabled_clamav

View File

@ -326,10 +326,12 @@ if [ -f /tmp/docker-mailserver/dovecot.cf ]; then
fi
# Start services related to SMTP
/etc/init.d/clamav-daemon start
if ! [ "$DISABLE_SPAMASSASSIN" = 1 ]; then
/etc/init.d/spamassassin start
fi
if ! [ "$DISABLE_CLAMAV" = 1 ]; then
/etc/init.d/clamav-daemon start
fi
if ! [ "$DISABLE_AMAVIS" = 1 ]; then
/etc/init.d/amavis start
fi

View File

@ -47,6 +47,11 @@
[ "$status" -eq 1 ]
}
@test "checking process: clamav (clamav disabled by DISABLE_CLAMAV)" {
run docker exec mail_disabled_clamav /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/clamd'"
[ "$status" -eq 1 ]
}
#
# imap
#