-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcompose-up.sh
executable file
·59 lines (48 loc) · 1.71 KB
/
compose-up.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
set -a # automatically export all variables
COMMIT=$(git rev-parse --short HEAD)
USER_ID=$(id -u)
GROUP_ID=${GROUP_ID:-$(id -g)}
COMPOSE_PROJECT_NAME=carla-pedestrians
PLATFORM=${PLATFORM:-nvidia} # nvidia or cpu
SHM_SIZE=${SHM_SIZE:-8gb}
COMMON_DIR=./pedestrians-common
CARLA_SERVER_DIR=${COMMON_DIR}/server
VIDEO2CARLA_DIR=./pedestrians-video-2-carla
SCENARIOS_DIR=./pedestrians-scenarios
VIZ_DIR=./carlaviz
source ${COMMON_DIR}/.env
source ${VIDEO2CARLA_DIR}/.env
source ${SCENARIOS_DIR}/.env
source ${VIZ_DIR}/.env
# Use BuildKit by default
COMPOSE_DOCKER_CLI_BUILD=1
DOCKER_BUILDKIT=1
set +a # end of automatic export
if [ $PLATFORM == "cpu" ]; then
COMPOSE_ARGS=(-f "${VIDEO2CARLA_DIR}/docker-compose.yml"
-f "${SCENARIOS_DIR}/docker-compose.yml")
else
COMPOSE_ARGS=(-f "${CARLA_SERVER_DIR}/docker-compose.yml"
-f "${VIDEO2CARLA_DIR}/docker-compose.yml"
-f "${VIDEO2CARLA_DIR}/docker-compose.nvidia.yml"
-f "${VIZ_DIR}/docker-compose.yml"
-f "${SCENARIOS_DIR}/docker-compose.yml")
fi
# first, build the common image used by the containers
# specifying the docker-compose.yml from the main repo first allows to set the 'root path' correctly
docker-compose \
-f "docker-compose.yml" \
-f "${COMMON_DIR}/docker-compose.yml" \
build
# 'scenarios' container needs 'common' to be build first, so we need separate step
docker-compose \
-f "docker-compose.yml" \
-f "${SCENARIOS_DIR}/docker-compose.yml" \
build
# then build & run the actual services
# selected services can be run by passing their names as arguments
docker-compose \
-f "docker-compose.yml" \
${COMPOSE_ARGS[@]} \
up -d --build $@