wordpress/test
2023-02-11 04:24:19 +01:00

48 lines
889 B
Bash
Executable File

#!/bin/bash
TMP=/tmp/wordpress
TIMEOUT=120
tear_down () {
docker-compose stop
docker-compose down -v --remove-orphans
docker network prune -f
cd ..
rm -rf $TMP
}
mkdir $TMP
cat env.sample | sed "s/USER_GROUP.*$/USER_GROUP=`id -u`:`id -g`/" > $TMP/.env
cat docker-compose.yml | sed 's/registry.sindominio.net\/wordpress/wordpress/' > $TMP/docker-compose.yml
cd $TMP
mkdir db uploads
docker-compose down -v --remove-orphans
docker-compose up -d
# Wait for the web server to respond
cont=0
echo -n "Espera al servidor web "
while ! curl -s localhost:12001 > /dev/null; do
echo -n "."
cont=$((cont+1))
if [ "$cont" == $TIMEOUT ]; then
echo " no responde"
tear_down
exit 1
fi
sleep 1
done
echo " connectado"
STR=`curl -s localhost:12001 |grep "Hello world!"`
tear_down
if [[ "$STR" == "" ]]
then
echo "No encontre 'Hello world!' en la web del contenedor"
exit 1
fi