-
Notifications
You must be signed in to change notification settings - Fork 0
/
d
executable file
·41 lines (27 loc) · 872 Bytes
/
d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# local settings
IMG_NAME=aerlaut/laravel-dev
HOST=0.0.0.0
PORT=8080
TEST_CONTAINER_NAME=laravel-dev-test
if [ "$1" == 'build' ]; then
# echo ask for tag
if [ -n "$2" ]; then
echo "Building image : $IMG_NAME:$2"
docker rmi -f "$IMG_NAME":"$2"
docker build . -f Dockerfile -t "$IMG_NAME":"$2"
else
echo "Building image : $IMG_NAME:dev"
docker rmi -f "$IMG_NAME":dev
docker build . -f Dockerfile -t "$IMG_NAME":dev
fi
elif [ "$1" == 'up' ]; then
docker kill $TEST_CONTAINER_NAME
docker run --rm -p $HOST:$PORT:80 --name $TEST_CONTAINER_NAME $IMG_NAME
echo "Container $TEST_CONTAINER_NAME running at http://$HOST:$PORT"
elif [ "$1" == 'down' ]; then
docker kill $TEST_CONTAINER_NAME
echo "Container $TEST_CONTAINER_NAME killed"
elif [ "$1" == 'sh' ]; then
docker exec -it "$TEST_CONTAINER_NAME" /bin/sh
fi