-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
develop.sh
executable file
·38 lines (32 loc) · 1020 Bytes
/
develop.sh
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
#!/bin/bash
# HELP
# ./develop.sh build and bring up containers
# ./develop.sh manage ... executes the manage.py script with the given arguments in a docker container
# ./develop.sh ... passes the arguments to docker-compose command
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
echo "Checking docker compose version"
if docker compose version &> /dev/null; then
DOCKER_COMPOSE_CMD="docker compose"
else
DOCKER_COMPOSE_CMD="docker-compose"
fi
function invoke_docker_compose {
exec $DOCKER_COMPOSE_CMD -f docker/docker-compose.dev.yml \
-p metabrainz \
"$@"
}
function invoke_manage {
invoke_docker_compose run --rm web \
python3 manage.py \
"$@"
}
if [[ $# -eq 0 ]]; then
invoke_docker_compose up --build
elif [[ "$1" == "manage" ]]; then shift
echo "Running manage.py..."
invoke_manage "$@"
else
echo "Running docker-compose with the given command..."
invoke_docker_compose "$@"
fi