-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
69 lines (63 loc) · 2.16 KB
/
.gitlab-ci.yml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
stages:
- build
- deploy
build-docker-image-stable:
stage: build
image: docker:19.03.12
services:
- name: docker:19.03.13-dind
command: [ "--registry-mirror", $CI_REGISTRY ]
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:stable
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -f docker/build.Dockerfile -t $IMAGE_TAG .
- docker push $IMAGE_TAG
only:
- master
tags:
- DIND
deploy-docker-image-stable:
stage: deploy
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:stable
script:
- chmod 0600 $SSH_KEY_ROBOLAB
- ssh -o StrictHostKeyChecking=no -i $SSH_KEY_ROBOLAB [email protected] docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- ssh -o StrictHostKeyChecking=no -i $SSH_KEY_ROBOLAB [email protected] docker pull $IMAGE_TAG
- ssh -o StrictHostKeyChecking=no -i $SSH_KEY_ROBOLAB [email protected] docker-compose -f /home/deploy/web-projects/robolab-docker/docker-compose.yml up -d
only:
- master
tags:
- robolab
- shell
build-docker-image-latest:
stage: build
image: docker:19.03.12
services:
- name: docker:19.03.13-dind
command: [ "--registry-mirror", $CI_REGISTRY ]
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -f docker/build.Dockerfile -t $IMAGE_TAG .
- docker push $IMAGE_TAG
only:
- develop
tags:
- DIND
deploy-docker-image-latest:
stage: deploy
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
script:
- chmod 0600 $SSH_KEY_ROBOLAB
- ssh -o StrictHostKeyChecking=no -i $SSH_KEY_ROBOLAB [email protected] docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- ssh -o StrictHostKeyChecking=no -i $SSH_KEY_ROBOLAB [email protected] docker pull $IMAGE_TAG
- ssh -o StrictHostKeyChecking=no -i $SSH_KEY_ROBOLAB [email protected] docker-compose -f /home/deploy/web-projects/robolab-docker/docker-compose.yml up -d
only:
- develop
tags:
- robolab
- shell