зеркало из https://github.com/mozilla/fxa.git
fix(docker): implement container trap for docker
This commit is contained in:
Родитель
0c3b8505dc
Коммит
ff2608c7cb
|
@ -1,18 +1,23 @@
|
|||
#!/bin/bash
|
||||
#!/bin/bash -ex
|
||||
|
||||
container_id=$(docker ps -a | grep pafortin/goaws | cut -d' ' -f1)
|
||||
if [ -z "$container_id" ]; then
|
||||
docker run --name goaws -p 4100:4100 pafortin/goaws
|
||||
else
|
||||
is_up=$(docker ps -a | grep pafortin/goaws | grep Up | cut -d' ' -f1)
|
||||
if [ -z "$is_up" ]; then
|
||||
docker start $container_id
|
||||
echo "starting $container_id"
|
||||
fi
|
||||
fi
|
||||
|
||||
function finish {
|
||||
echo "stopping $container_id"
|
||||
docker stop $container_id
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
|
||||
if [ -z "$container_id" ]; then
|
||||
docker run --name goaws -p 4100:4100 pafortin/goaws
|
||||
while true; do sleep 1000; done
|
||||
|
||||
else
|
||||
is_up=$(docker ps -a | grep pafortin/goaws | grep Up | cut -d' ' -f1)
|
||||
if [ -z "$is_up" ]; then
|
||||
docker start $container_id
|
||||
echo "starting $container_id"
|
||||
while true; do sleep 1000; done
|
||||
fi
|
||||
fi
|
||||
|
|
Загрузка…
Ссылка в новой задаче