-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·40 lines (34 loc) · 798 Bytes
/
run.sh
File metadata and controls
executable file
·40 lines (34 loc) · 798 Bytes
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
#!/bin/bash
source .env
get_health() {
docker inspect --format '{{.State.Health.Status}}' $1
}
if [ $CREATE_CONTAINER -ne 0 ]
then
case $RDBMS in
'postgres')
DOCKER_PORT=5432
PREFIX='POSTGRES'
;;
'mysql')
DOCKER_PORT=3306
PREFIX='MYSQL'
;;
*)
echo "Unsupported RDBMS: $RDBMS"
return 2
;;
esac
docker container stop $CONTAINER_NAME && docker container rm $CONTAINER_NAME
docker build -t $IMAGE_NAME $RDBMS
docker run -d -p $PORT:$DOCKER_PORT --name $CONTAINER_NAME \
-e ${PREFIX}_USER=$USER -e ${PREFIX}_PASSWORD=$PASSWORD \
-e ${PREFIX}_DB=$DB -e ${PREFIX}_DATABASE=$DB \
-e MYSQL_ROOT_PASSWORD=$PASSWORD $IMAGE_NAME
while [ $(get_health $CONTAINER_NAME) != 'healthy' ]
do
sleep 1
done
fi
source venv/bin/activate
python src/generate_data.py