2021-09-09 20:13:39 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
up)
|
2021-09-09 23:21:22 -04:00
|
|
|
if ! [ -d venv ]; then
|
|
|
|
docker run --rm -v "$PWD:$PWD" -w "$PWD" python:3.7-buster \
|
|
|
|
sh -c "python -m venv venv && . venv/bin/activate && pip install -r dev-requirements.txt && pip install -r requirements.txt"
|
|
|
|
fi
|
2021-09-09 20:13:39 -04:00
|
|
|
docker network create ceod
|
|
|
|
for host in auth1 coffee mail phosphoric-acid; do
|
|
|
|
if [ $host = auth1 -o $host = coffee ]; then
|
|
|
|
image=debian:buster
|
|
|
|
else
|
|
|
|
image=python:3.7-buster
|
|
|
|
fi
|
|
|
|
docker run \
|
|
|
|
--detach \
|
|
|
|
--name $host \
|
|
|
|
--hostname $host \
|
|
|
|
--network ceod \
|
|
|
|
--volume "$PWD:$PWD" \
|
|
|
|
--workdir "$PWD" \
|
|
|
|
$image .drone/$host-setup.sh
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
down)
|
|
|
|
for host in auth1 coffee mail phosphoric-acid; do
|
|
|
|
docker kill $host
|
|
|
|
docker rm $host
|
|
|
|
done
|
|
|
|
docker network rm ceod
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo 'Usage: docker.sh <up|down>' >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|