wordpress/test
2023-02-04 15:48:11 +01:00

46 lines
822 B
Bash
Executable File

#!/bin/bash
TMP=/tmp/wordpress
TIMEOUT=120
tear_down () {
docker-compose stop
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