diff --git a/codebase/docker/start.sh b/codebase/docker/start.sh new file mode 100755 index 0000000..866afc9 --- /dev/null +++ b/codebase/docker/start.sh @@ -0,0 +1,37 @@ +#!/usr/bin/bash + +set -x + +# Build image +if [ "$(docker network list | grep laravel_net)" == "" ] +then + docker network create laravel_net +fi + + +if [ "$(docker container list | grep laraveldb)" == "" ] +then +docker run --name laraveldb --net laravel_net -p 3306:3306 -d \ + -e MYSQL_USER=myuser \ + -e MYSQL_PASSWORD=password \ + -e MYSQL_DATABASE=laravel \ + -e MYSQL_ALLOW_EMPTY_PASSWORD=true \ + mysql:latest +fi + +# only build image if it doesn't exist +if [ "$(docker image list | grep laravelio)" == "" ] +then + docker build . -t laravelio +fi + +docker run --name laravel --net laravel_net -p 80:8000 -d \ + -e DB_CONNECTION=mysql \ + -e DB_HOST=laraveldb \ + -e DB_DATABASE=laravel \ + -e DB_USERNAME=myuser \ + -e DB_PASSWORD=password \ + laravelio + +curl --write-out '%{http_code}' --silent http://localhost:80/ --output output.html +