-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
49 lines (47 loc) · 1.47 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
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
build:
stage: build
tags:
- build
image: docker:latest
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
DOCKER_TLS_CERTDIR: "/certs"
VERSION: "v1.1"
# Specify an additional image 'docker:dind' ("Docker-in-Docker") that
# will start up the Docker daemon when it is brought up by a runner.
services:
- name: docker:dind
script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker tag $IMAGE_TAG $CI_REGISTRY_IMAGE:$VERSION
- docker push $IMAGE_TAG
- docker push $CI_REGISTRY_IMAGE:$VERSION
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
build_dev:
stage: build
tags:
- build_dev
image: docker:latest
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
DOCKER_TLS_CERTDIR: "/certs"
# Specify an additional image 'docker:dind' ("Docker-in-Docker") that
# will start up the Docker daemon when it is brought up by a runner.
services:
- name: docker:dind
script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker tag $IMAGE_TAG $CI_REGISTRY_IMAGE:develop
- docker push $IMAGE_TAG
- docker push $CI_REGISTRY_IMAGE:develop
rules:
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH