Skip to content

Commit

Permalink
Add gitlab ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhmylife committed May 3, 2019
1 parent 34181dc commit d1ae62f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
variables:
DOCKER_DRIVER: "overlay2"
REPOSITORY_URL: "changeme:latest"

stages:
- build
- deploy

services:
- docker:dind

build-app:
stage: build
tags:
- docker
script:
- mkdir -p $HOME/.docker
- apk add --no-cache curl jq python py-pip
- pip install awscli
- $(aws ecr get-login --no-include-email --region ap-southeast-1)
- docker info
- docker build -t ${REPOSITORY_URL} .
- docker push ${REPOSITORY_URL}

deploy-app:
stage: deploy
image: alpine
only:
- master
script:
- apk add --no-cache curl
- 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
- mv ./kubectl /usr/local/bin/kubectl
- kubectl config set-cluster k8s --server="$KUBE_URL" --insecure-skip-tls-verify=true
- kubectl config set-credentials admin --token="$KUBE_TOKEN"
- kubectl config set-context default --cluster=k8s --user=admin
- kubectl config use-context default
- cd k8s && kubectl apply -f -
- kubectl patch deployment backend -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"

0 comments on commit d1ae62f

Please sign in to comment.