File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash -e
2
+ SCRIPTDIR=$( python -c ' import os,sys;print os.path.dirname(os.path.realpath(sys.argv[1]))' " $0 " )
2
3
3
- docker build -t asylum_dev .
4
- docker run --name asylum_dev -d -p 8000:8000 -p 1080:1080 -v ` pwd -P` /project:/opt/asylum asylum_dev
5
- read -p " Press enter to stop and remove the server" dummy
6
- docker stop asylum_dev
7
- docker rm asylum_dev
4
+ # Make sure we're in the correct place relative to Dockerfile no matter where we were called from
5
+ cd ` dirname " $SCRIPTDIR " `
8
6
7
+ if [ " $( docker images asylum_dev:latest ) " == " " ]
8
+ then
9
+ docker build -t asylum_dev .
10
+ fi
11
+ echo " Starting devel server."
12
+ echo " To connect to shell in this instance run: docker exec -it asylum_dev /bin/bash"
13
+ echo " Then in that shell run: source ../asylum-venv/bin/activate"
14
+ if [ " $( docker ps -a -q -f name=asylum_dev) " == " " ]
15
+ then
16
+ echo " First run"
17
+ set -x
18
+ docker run --name asylum_dev -i -p 8000:8000 -p 1080:1080 -v ` pwd -P` /project:/opt/asylum asylum_dev
19
+ set +x
20
+ else
21
+ set -x
22
+ docker start -i asylum_dev
23
+ set +x
24
+ fi
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ cd `dirname "$SCRIPTDIR"`
6
6
7
7
docker build -t asylum_test .
8
8
echo " Starting test server."
9
- echo " To connect to shell in this instance run: docker exec -it $( docker ps | grep asylum_test | awk ' {print $1} ' ) /bin/bash"
9
+ echo " To connect to shell in this instance run: docker exec -it asylum_test /bin/bash"
10
10
echo " Then in that shell run: source ../asylum-venv/bin/activate"
11
11
docker run --rm --name asylum_test -it -p 8000:8000 -p 1080:1080 asylum_test
You can’t perform that action at this time.
0 commit comments