Newer
Older
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
35
36
37
38
39
40
41
stages:
- build_and_push
- redeploy
variables:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
build_and_push:
image: docker/compose:latest
stage: build_and_push
services:
- docker:dind
script:
- docker login docker.io -u "$DOCKER_REGISTRY_USER" -p "$DOCKER_REGISTRY_PASSWORD"
- echo We download previous build for using as cache from
- docker-compose pull
- docker-compose build
- docker-compose push
tags:
- docker
only:
- kubernetes
redeploy_at_k8s:
image: alpine/k8s:1.21.5
stage: redeploy
script:
- kubectl config set-cluster local --server="${K8S_SERVER}"
- kubectl config set clusters.local.certificate-authority-data "${K8S_CERTIFICATE_AUTHORITY_DATA}"
- kubectl config set-credentials local --token="${K8S_USER_TOKEN}"
- kubectl config set-context local --cluster=local --user=local
- kubectl config use-context local
- kubectl --insecure-skip-tls-verify version
- kubectl get deployments ujse -n ujse-dev --insecure-skip-tls-verify
- kubectl rollout restart deployment ujse -n ujse-dev --insecure-skip-tls-verify
tags:
- docker
only:
- kubernetes
when: manual