-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
45 lines (40 loc) · 1012 Bytes
/
.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
stages:
- build-image
- tag-image
variables:
BUILD_IMAGE: qpr-registry.iti.kit.edu/gbd/gbd:$CI_COMMIT_SHA
RELEASE_IMAGE: qpr-registry.iti.kit.edu/gbd/gbd:latest
build-image:
image: docker:stable
services:
- docker:dind
stage: build-image
tags:
- docker
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "develop"'
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
after_script:
- docker logout $CI_REGISTRY
script:
- docker build -t $BUILD_IMAGE .
- docker push $BUILD_IMAGE
tag-image:
image: docker:stable
services:
- docker:dind
stage: tag-image
tags:
- docker
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
after_script:
- docker logout $CI_REGISTRY
script:
- docker pull $BUILD_IMAGE
- docker tag $BUILD_IMAGE $RELEASE_IMAGE
- docker push $RELEASE_IMAGE