Added gitlab-ci.

Signed-off-by: Pavel Kirilin <win10@list.ru>
This commit is contained in:
2021-12-07 11:25:40 +04:00
parent 1a506035ea
commit d9e945ee92
22 changed files with 582 additions and 49 deletions

50
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,50 @@
variables:
APP_VERSION: $CI_COMMIT_REF_SLUG
DOCKER_AUTH_CONFIG: '{"auths":{"$DOCKER_REGISTRY":{"username":"$DOCKER_USER","password":"$DOCKER_PASSWORD"}}}'
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.6.0-debug
entrypoint: [""]
tags:
- kube
only:
- master
script:
- mkdir -p /kaniko/.docker
- echo "$DOCKER_AUTH_CONFIG" > /kaniko/.docker/config.json
- /kaniko/executor
--context .
--dockerfile deploy/Dockerfile
--destination "$DOCKER_REGISTRY/s3rius/blog:latest"
--cache=true
--force
deploy:
stage: deploy
image:
name: alpine/helm:3.7.1
entrypoint: ["/bin/sh", "-c"]
tags:
- kube
only:
- master
environment:
name: blog-production
kubernetes:
namespace: "$NAMESPACE"
action: start
url: "https://s3rius.blog/"
script:
- helm
upgrade
"s3rius-blog"
./deploy/helm
--install
--wait
--create-namespace
--atomic
--timeout 2m
--namespace "$NAMESPACE"
-f "$HELM_CONFIG"