-
Notifications
You must be signed in to change notification settings - Fork 0
/
ds.sh
executable file
·56 lines (42 loc) · 1.09 KB
/
ds.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
#!/bin/sh
PROJECT_ID="$(gcloud config get-value project --quiet)"
# IMG_NAME=weeve-ui
# VERSION=v01
DOCKER_FOLDER=./docker
UI_IMG_NAME=weeve-ui
UI_TAG_NAME=gcr.io/$PROJECT_ID/$UI_IMG_NAME:latest
case "$1" in
build)
echo "building"
docker build -t $UI_IMG_NAME -f $DOCKER_FOLDER/weeve-ui.dockerfile .
if [[ ! -z $(docker images -f "dangling=true" -q) ]]
then
echo "Deleting dangling images"
docker rmi $(docker images -f "dangling=true" -q)
fi
;;
push)
echo "pushing"
docker tag $UI_IMG_NAME $UI_TAG_NAME
if [[ ! -z $(docker images -f "dangling=true" -q) ]]
then
echo "Deleting dangling images"
docker rmi $(docker images -f "dangling=true" -q)
fi
gcloud docker -- push $UI_TAG_NAME
docker rmi $UI_TAG_NAME
;;
clean)
docker kill $(docker ps -aq)
docker rm $(docker ps -aq)
if [[ ! -z $(docker images -f "dangling=true" -q) ]]
then
echo "Deleting dangling images"
docker rmi $(docker images -f "dangling=true" -q)
fi
;;
*)
echo "Usage: "$1" {build|push}"
exit 1
esac
exit 0