-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
34 lines (33 loc) · 2.09 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
# NOTE - fibonacci-api is used instead of fibonacci-server cos thats how we used it in original fibonacci project
# Want to use same docker hub image so used that
# build & tag our current images
# tag it twice, once for the image and once with the git sha attached
# with the git sha we always have a unique build so k8s can pick up that the image is different
# Also useful as we can check out git repo using the sha to see code as it was at that point in time
docker build -t eoinwhelan64/fibonacci-client:k8s -t eoinwhelan64/fibonacci-client:$GIT_SHA ./client
docker build -t eoinwhelan64/fibonacci-api:k8s -t eoinwhelan64/fibonacci-api:$GIT_SHA ./server
docker build -t eoinwhelan64/fibonacci-worker:k8s -t eoinwhelan64/fibonacci-worker:$GIT_SHA ./worker
# Push up to HUB, the k8s version
docker push eoinwhelan64/fibonacci-client:k8s
docker push eoinwhelan64/fibonacci-api:k8s
docker push eoinwhelan64/fibonacci-worker:k8s
# do another push for the sha version of the images
# We'll actually be deploying this
docker push eoinwhelan64/fibonacci-client:$GIT_SHA
docker push eoinwhelan64/fibonacci-api:$GIT_SHA
docker push eoinwhelan64/fibonacci-worker:$GIT_SHA
# Apply them with kubectl
# Travis will have kubectl set up by this poit, so this works
kubectl apply -f k8s
# make sure its the latest image, in my case always
# make it be k8s version so not really necessary
# we're kinda telling it here to always use k8s version, still imperative
# so serves same purpose of forcing an imperative command in our deployment
# VERY IMPORTANT
# Know we are deploying k8s version of app on google CLOUD
# we deploy regular version to AWS.
# Currently only using SHA with gcp, so any image commits with that on hub are k8s version
# TODO - find out if can sub tag images, eg eoinwhelan64/fibonacci-client:k8s.v1 etc, can prob just do k8s_$GIT_SHA as partial step
kubectl set image deployments/server-deployment server=eoinwhelan64/fibonacci-api:$GIT_SHA
kubectl set image deployments/client-deployment client=eoinwhelan64/fibonacci-client:$GIT_SHA
kubectl set image deployments/worker-deployment worker=eoinwhelan64/fibonacci-worker:$GIT_SHA