script to help deployment
This commit is contained in:
parent
e4287b20f0
commit
367397f39c
1 changed files with 37 additions and 0 deletions
37
codebase/docker/start.sh
Executable file
37
codebase/docker/start.sh
Executable file
|
@ -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
|
||||
|
Loading…
Reference in a new issue