forked from happilymarrieddad/k8s-hyperledger-fabric-2.2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·87 lines (56 loc) · 2.19 KB
/
deploy.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Using git to version control the images
VERSION=$(git rev-parse HEAD)
# These are optional arguments
# usage - ./deploy.sh <docker-username> <go-api-name> <node-api-name> <web-app-name>
# example - ./deploy.sh someuser go-api node-api web-app
DOCKER_USERNAME=${1-happilymarrieddadudemy}
GO_API_REPO=${2-udemy-go-api}
NODE_API_REPO=${3-udemy-node-api}
WEB_APP_REPO=${4-udemy-web-app}
## Push up and set GO API
docker build -t ${DOCKER_USERNAME}/${GO_API_REPO}:${VERSION} \
-f ./go-api/Dockerfile \
./go-api
docker push ${DOCKER_USERNAME}/${GO_API_REPO}:${VERSION}
docker build -t ${DOCKER_USERNAME}/${GO_API_REPO}:latest \
-f ./go-api/Dockerfile \
./go-api
docker push ${DOCKER_USERNAME}/${GO_API_REPO}:latest
# sleep 10
#kubectl set image deployments/api-deployment api=${DOCKER_USERNAME}/${GO_API_REPO}:${VERSION}
# sleep 5
## Push up and set Node API
docker build -t ${DOCKER_USERNAME}/${NODE_API_REPO}:${VERSION} \
-f ./node-api/Dockerfile \
./node-api
docker push ${DOCKER_USERNAME}/${NODE_API_REPO}:${VERSION}
docker build -t ${DOCKER_USERNAME}/${NODE_API_REPO}:latest \
-f ./node-api/Dockerfile \
./node-api
docker push ${DOCKER_USERNAME}/${NODE_API_REPO}:latest
# sleep 10
#kubectl set image deployments/api-deployment api=${DOCKER_USERNAME}/${NODE_API_REPO}:${VERSION}
# sleep 5
## Push up web app production
docker build -t ${DOCKER_USERNAME}/${WEB_APP_REPO}:${VERSION} \
-f ./frontend/Dockerfile \
./frontend
docker push ${DOCKER_USERNAME}/${WEB_APP_REPO}:${VERSION}
docker build -t ${DOCKER_USERNAME}/${WEB_APP_REPO}:latest \
-f ./frontend/Dockerfile \
./frontend
docker push ${DOCKER_USERNAME}/${WEB_APP_REPO}:latest
## Push up web app local
docker build -t ${DOCKER_USERNAME}/${WEB_APP_REPO}:${VERSION}-local \
-f ./frontend/Dockerfile.dev \
./frontend
docker push ${DOCKER_USERNAME}/${WEB_APP_REPO}:${VERSION}-local
docker build -t ${DOCKER_USERNAME}/${WEB_APP_REPO}:latest-local \
-f ./frontend/Dockerfile.dev \
./frontend
docker push ${DOCKER_USERNAME}/${WEB_APP_REPO}:latest-local
# sleep 10
#kubectl set image deployments/web-deployment web=${DOCKER_USERNAME}/${WEB_APP_REPO}:${VERSION}
sleep 1
echo "Completed!"