-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
executable file
·57 lines (49 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
image: docker:stable
services:
- docker:stable-dind
variables:
REPOSITORY: "${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}"
OS: "centos"
OS_VERSION: "7"
before_script:
- docker login -u "${REGISTRY_USER}" -p "${REGISTRY_TOKEN}"
stages:
- base
- glvnd
.base_template: &base_definition
stage: base
script:
- docker pull "${REPOSITORY}:base-${OS}${OS_VERSION}" || true
- docker build --pull -t "${REPOSITORY}:base-${OS}${OS_VERSION}"
--cache-from "${REPOSITORY}:base-${OS}${OS_VERSION}"
--build-arg "from=${OS}:${OS_VERSION}"
"base/"
- if [[ "${NO_OS_SUFFIX}" == true ]]; then
docker tag "${REPOSITORY}:base-${OS}${OS_VERSION}" "${REPOSITORY}:base";
fi
- docker push "${REPOSITORY}"
.glvnd_template: &glvnd_definition
stage: glvnd
script:
- VERSION="${CI_JOB_NAME:1}"
- docker pull "${REPOSITORY}:${VERSION}-runtime-${OS}${OS_VERSION}" || true
- docker build --pull -t "${REPOSITORY}:${VERSION}-runtime-${OS}${OS_VERSION}"
--cache-from "${REPOSITORY}:${VERSION}-runtime-${OS}${OS_VERSION}"
--build-arg "from=${REPOSITORY}:base-${OS}${OS_VERSION}"
"${VERSION}/runtime"
- docker pull "${REPOSITORY}:${VERSION}-devel-${OS}${OS_VERSION}" || true
- docker build -t "${REPOSITORY}:${VERSION}-devel-${OS}${OS_VERSION}"
--cache-from "${REPOSITORY}:${VERSION}-devel-${OS}${OS_VERSION}"
--build-arg "from=${REPOSITORY}:${VERSION}-runtime-${OS}${OS_VERSION}"
"${VERSION}/devel"
- if [[ "${NO_OS_SUFFIX}" == true ]]; then
docker tag "${REPOSITORY}:${VERSION}-runtime-${OS}${OS_VERSION}" "${REPOSITORY}:${VERSION}-runtime";
docker tag "${REPOSITORY}:${VERSION}-runtime-${OS}${OS_VERSION}" "${REPOSITORY}:runtime";
docker tag "${REPOSITORY}:${VERSION}-devel-${OS}${OS_VERSION}" "${REPOSITORY}:${VERSION}-devel";
docker tag "${REPOSITORY}:${VERSION}-devel-${OS}${OS_VERSION}" "${REPOSITORY}:devel";
fi
- docker push "${REPOSITORY}"
base:
<<: *base_definition
v1.0-glvnd:
<<: *glvnd_definition