-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker_deploy
15 lines (15 loc) · 1.12 KB
/
docker_deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
echo "Deploying: ${DOCKER_PUBLIC_USERNAME}/${DOCKER_IMAGE_NAME}:${TRAVIS_BUILD_ID}"
docker push ${DOCKER_PUBLIC_USERNAME}/${DOCKER_IMAGE_NAME}:${TRAVIS_BUILD_ID}
docker tag ${DOCKER_PUBLIC_USERNAME}/${DOCKER_IMAGE_NAME}:${TRAVIS_BUILD_ID} ${DOCKER_PUBLIC_USERNAME}/${DOCKER_IMAGE_NAME}:development
#for now tag with development in future with specific bracch tags
docker push ${DOCKER_PUBLIC_USERNAME}/${DOCKER_IMAGE_NAME}:development
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
mkdir ${HOME}/.kube
echo "$KUBE_CONFIG" | base64 --decode > ${HOME}/.kube/config
echo "Deploying: deployment/${K8S_DEPLOYMENT_NAME}"
kubectl set image deployment/${K8S_DEPLOYMENT_NAME} ${K8S_DEPLOYMENT_NAME}=${DOCKER_PUBLIC_USERNAME}/${DOCKER_IMAGE_NAME}:${TRAVIS_BUILD_ID} --record -n ${K8S_NAMESPACE}
echo "Deployed:" ${DOCKER_PUBLIC_USERNAME}/${DOCKER_IMAGE_NAME}:${TRAVIS_BUILD_ID}