mailcow/006-build-php-fpm.sh

35 lines
1019 B
Bash
Raw Normal View History

2016-12-10 03:39:02 +08:00
#!/bin/bash
. mailcow.conf
NAME="php-fpm-mailcow"
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
if [[ ! -z "$(docker images -q php:${PHPVERS})" ]]; then
2016-12-10 03:52:19 +08:00
read -r -p "Found image locally. Delete local image and repull? [y/N] " response
2016-12-10 03:39:02 +08:00
response=${response,,}
if [[ $response =~ ^(yes|y)$ ]]; then
docker rmi php:${PHPVERS}
fi
fi
docker run \
-v ${PWD}/data/web:/web:ro \
2016-12-10 07:39:27 +08:00
-v ${PWD}/data/conf/rspamd/dynmaps:/dynmaps:ro \
2016-12-10 03:39:02 +08:00
-v ${PWD}/data/dkim/:/shared/dkim/ \
-d --network=${DOCKER_NETWORK} \
2016-12-13 04:53:58 +08:00
--name ${NAME} \
-h phpfpm \
php:${PHPVERS}
2016-12-10 03:39:02 +08:00
echo "Installing intl and mysql pdo extension..."
2016-12-13 04:53:58 +08:00
docker exec ${NAME} /bin/bash -c "apt-get update && apt-get install -y zlib1g-dev libicu-dev g++ libidn11-dev"
2016-12-10 03:39:02 +08:00
docker exec ${NAME} docker-php-ext-configure intl pdo pdo_mysql
docker exec ${NAME} docker-php-ext-install intl pdo pdo_mysql
echo "Restarting container..."
docker restart ${NAME}