linux - started work on bunkerized-nginx command

This commit is contained in:
bunkerity
2021-06-22 21:19:12 +02:00
parent b448d91ca8
commit d0366fcc0d
10 changed files with 100 additions and 6 deletions

1
tests/index.html Normal file
View File

@@ -0,0 +1 @@
ok

View File

@@ -7,7 +7,7 @@ function cleanup() {
image="$1"
echo "[*] Run $image"
id="$(docker run --rm -d -it "$image")"
id="$(docker run --rm -d -it -p 80:80 "$image")"
if [ $? -ne 0 ] ; then
echo "[!] docker run failed"
cleanup "$id"
@@ -53,3 +53,35 @@ if [ $? -ne 0 ] ; then
cleanup "$id"
exit 6
fi
echo "[*] Copy variables.env"
docker cp "tests/variables.env:$id" /opt/bunkerized-nginx/variables.env
if [ $? -ne 0 ] ; then
echo "[!] docker cp failed"
cleanup "$id"
exit 7
fi
echo "[*] Copy index.html"
docker cp "tests/index.html:$id" /opt/bunkerized-nginx/www
if [ $? -ne 0 ] ; then
echo "[!] docker cp failed"
cleanup "$id"
exit 8
fi
echo "[*] Exec bunkerized-nginx"
docker exec "$id" bunkerized-nginx
if [ $? -ne 0 ] || [ "$res" != "ok" ] ; then
echo "[!] docker exec failed"
cleanup "$id"
exit 9
fi
echo "[*] Exec curl"
res="$(curl -s http://localhost/")
if [ $? -ne 0 ] || [ "$res" != "ok" ] ; then
echo "[!] curl failed"
cleanup "$id"
exit 10
fi

3
tests/variables.env Normal file
View File

@@ -0,0 +1,3 @@
HTTP_PORT=80
HTTPS_PORT=443
SERVER_NAME=www.test.com