Switch to ci template and move Dockerfile
This commit is contained in:
parent
eff1b2c373
commit
02b0ffcfa3
|
|
@ -1,54 +1,11 @@
|
|||
stages:
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
|
||||
kaniko:
|
||||
tags:
|
||||
- docker
|
||||
stage: build
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
||||
variables:
|
||||
DOCKER_IMAGE_ENVS: "production"
|
||||
|
||||
kubernetes:
|
||||
tags:
|
||||
- turniere-deploy
|
||||
stage: deploy
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
variables:
|
||||
- $FORCE_DEPLOY
|
||||
image: ruby
|
||||
variables:
|
||||
KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: gitlab-deploy
|
||||
script:
|
||||
- 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/bin/kubectl
|
||||
- kubectl config set-cluster k8s --server="https://kubernetes.default.svc" --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||
- kubectl config set-credentials sa --token="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
|
||||
- kubectl config set-context local --cluster=k8s --user=sa --namespace=turniere-frontend
|
||||
- gem install krane
|
||||
- krane render -f kubernetes --current-sha "$CI_COMMIT_SHA" | krane deploy turniere-frontend local -f -
|
||||
|
||||
deploy_watchtower:
|
||||
tags:
|
||||
- docker
|
||||
stage: deploy
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
variables:
|
||||
- $FORCE_DEPLOY
|
||||
image: docker
|
||||
services:
|
||||
- docker:dind
|
||||
script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE/production:deploy
|
||||
- docker push $CI_REGISTRY_IMAGE/production:deploy
|
||||
include:
|
||||
- project: 'turniere/turniere-infra'
|
||||
file: '/ci/pipeline.yaml'
|
||||
|
|
|
|||
Loading…
Reference in New Issue