mailcow/build-rmilter.sh

35 lines
778 B
Bash
Raw Normal View History

2016-12-10 03:39:02 +08:00
#!/bin/bash
. mailcow.conf
NAME="rmilter-mailcow"
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
build() {
2016-12-10 03:52:19 +08:00
docker build --no-cache -t rmilter data/Dockerfiles/rmilter/.
2016-12-10 03:39:02 +08:00
}
if [[ ! -z "$(docker images -q rmilter)" ]]; then
2016-12-10 03:52:19 +08:00
read -r -p "Found image locally. Delete local and rebuild without cache anyway? [y/N] " response
2016-12-10 03:39:02 +08:00
response=${response,,}
if [[ $response =~ ^(yes|y)$ ]]; then
docker rmi rmilter
build
fi
else
build
fi
docker run \
-v ${PWD}/data/conf/rmilter/:/etc/rmilter.conf.d/ \
--network=${DOCKER_NETWORK} \
--network-alias rmilter \
-h rmilter \
--name ${NAME} \
-d rmilter