mailcow/005-build-rspamd.sh

37 lines
1.1 KiB
Bash
Raw Normal View History

2016-12-10 03:39:02 +08:00
#!/bin/bash
. mailcow.conf
NAME="rspamd-mailcow"
PDNS_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pdns-mailcow 2> /dev/null)
if [[ ! ${PDNS_IP} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Cannot determine Powerdns Recursor ip address. Is the container running?"
exit 1
fi
2016-12-10 03:39:02 +08:00
echo "Stopping and removing containers with name tag ${NAME}..."
if [[ ! -z $(docker ps -af "name=${NAME}" -q) ]]; then
docker stop $(docker ps -af "name=${NAME}" -q)
docker rm $(docker ps -af "name=${NAME}" -q)
fi
# Needs network-alias because of different dns
2016-12-10 03:39:02 +08:00
docker run \
-v ${PWD}/data/conf/rspamd/override.d/:/etc/rspamd/override.d:ro \
-v ${PWD}/data/conf/rspamd/local.d/:/etc/rspamd/local.d:ro \
2016-12-13 04:53:58 +08:00
-v ${PWD}/data/conf/rspamd/lua/:/etc/rspamd/lua/:ro \
2016-12-10 03:39:02 +08:00
-v ${PWD}/data/dkim/txt/:/etc/rspamd/dkim/txt/:ro \
-v ${PWD}/data/dkim/keys/:/etc/rspamd/dkim/keys/:ro \
--dns=${PDNS_IP} \
2016-12-13 04:53:58 +08:00
--dns-search=${DOCKER_NETWORK} \
2016-12-10 03:39:02 +08:00
--network=${DOCKER_NETWORK} \
2016-12-13 20:44:12 +08:00
--network-alias=rspamd \
2016-12-10 03:39:02 +08:00
-h rspamd \
--name ${NAME} \
2016-12-14 05:12:54 +08:00
-d andryyy/mailcow-dockerized:rspamd
2016-12-10 03:39:02 +08:00
/bin/bash ./fix-permissions.sh