-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysql.sh
executable file
·52 lines (43 loc) · 1.03 KB
/
mysql.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
#!/bin/sh
VERSION=v0.7
TAG_NAME=gcr.io/$PROJECT_ID/$IMG_NAME:$VERSION
DOCKER_FOLDER=./docker
DB_IMG_NAME=weeve-db
DB_TAG_NAME=gcr.io/$PROJECT_ID/$API_IMG_NAME:latest
DB_CONTAINER_NAME=some-weeve-db
case "$1" in
clean)
if [[ ! -z $(docker images -f "dangling=true" -q) ]]
then
echo "Deleting dangling images"
docker rmi $(docker images -f "dangling=true" -q)
fi
;;
build)
echo "building image"
docker build -t $DB_IMG_NAME -f $DOCKER_FOLDER/local_mysql.dockerfile .
;;
start)
echo "creating container"
docker create -p 3306:3306 --name=$DB_CONTAINER_NAME $DB_IMG_NAME
echo "starting container"
docker start $DB_CONTAINER_NAME
;;
stop)
echo "stopping container"
docker stop $DB_CONTAINER_NAME
;;
kill)
echo "deleting container"
docker kill $DB_CONTAINER_NAME
docker rm $DB_CONTAINER_NAME
;;
delete)
echo "deleting image"
docker rmi $DB_IMG_NAME
;;
*)
echo "Usage: "$1" {build|start|stop|delete|clean}"
exit 1
esac
exit 0