-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
50 lines (45 loc) · 1.11 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
# Variables
variables:
DOCKER_DRIVER: "overlay2"
DOCKER_HOST: "tcp://docker:2376"
DOCKER_TLS_VERIFY: 1
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_CERT_PATH: "/certs/client"
# Anchors
.build-cmd: &build-cmd |-
docker build --pull --build-arg="TAG=${TAG}" -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}" .
docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
.build:
stage: build
image: docker:20
services:
- docker:20-dind
variables:
TAG: "3.13"
before_script:
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" ${CI_REGISTRY}
script:
- *build-cmd
# Jobs
build-master:
extends: .build
script:
- *build-cmd
- docker tag "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}" "${CI_REGISTRY_IMAGE}:latest"
- docker push "${CI_REGISTRY_IMAGE}:latest"
only:
- master
build-master-edge:
extends: .build
variables:
TAG: edge
script:
- *build-cmd
- docker tag "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}" "${CI_REGISTRY_IMAGE}:${TAG}"
- docker push "${CI_REGISTRY_IMAGE}:${TAG}"
only:
- master
build:
extends: .build
except:
- master