Skip to content

Commit 223e4a6

Browse files
committed
do not nuke the image at each iteration, faster iterations
1 parent 6b62de0 commit 223e4a6

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

docker/dev.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
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")
23

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"`
86

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

docker/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ cd `dirname "$SCRIPTDIR"`
66

77
docker build -t asylum_test .
88
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"
1010
echo "Then in that shell run: source ../asylum-venv/bin/activate"
1111
docker run --rm --name asylum_test -it -p 8000:8000 -p 1080:1080 asylum_test

0 commit comments

Comments
 (0)