forked from yearn/yearn-exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·29 lines (26 loc) · 881 Bytes
/
run.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
#! /bin/bash
set -e
if [[ -z "${COMMANDS}" ]]; then
echo "please provide a list of commands to run via \$COMMANDS."
exit 1
fi
export SENTRY_RELEASE=$(git rev-parse --short HEAD)
IFS=',' read -r -a commands <<< "$COMMANDS"
for CMD in "${commands[@]}"; do
NAME=$(echo $CMD | sed -e 's/[_/ ]/-/g')
if [[ ! -z "${NAME_SUFFIX}" ]]; then
NAME_SUFFIX="-${NAME_SUFFIX}"
fi
export CONTAINER_NAME=${PROJECT_PREFIX}-${NAME}${NAME_SUFFIX}-1
docker rm -f $CONTAINER_NAME 2> /dev/null || true
docker-compose \
--file services/dashboard/docker-compose.yml \
--project-directory . \
-p $PROJECT_PREFIX run \
--name $CONTAINER_NAME \
--detach \
exporter $CMD
# hack to manually patch the container docker config so the container is restarted
# if the docker-compose run failed
docker container update --restart on-failure $CONTAINER_NAME
done