-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
24 lines (22 loc) · 1.26 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
services:
- docker:dind
variables:
UPSTREAM_IMAGE: $CI_REGISTRY/telekom/$CI_PROJECT_NAME
DOCKER_HOST: tcp://docker:2375/
build:
image: docker:stable
stage: build
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker pull $UPSTREAM_IMAGE:latest || true
- docker build --cache-from $UPSTREAM_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- if [ "${CI_COMMIT_REF_NAME}" != "master" ]; then docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; fi;
- if [ "${CI_COMMIT_REF_NAME}" == "master" ]; then docker push $CI_REGISTRY_IMAGE:latest; fi;
- if [ "${CI_PROJECT_PATH}" == "telekom/pointcloud-tiler" ] && [ ! -z "${CI_COMMIT_TAG}" ]; then
docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA mtr.external.otc.telekomcloud.com/ftth/pointcloud-tiler:latest &&
docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA mtr.external.otc.telekomcloud.com/ftth/pointcloud-tiler:$CI_COMMIT_TAG &&
docker login -u $FTTH_MTR_USER -p $FTTH_MTR_PW mtr.external.otc.telekomcloud.com &&
docker push mtr.external.otc.telekomcloud.com/ftth/pointcloud-tiler:$CI_COMMIT_TAG;
fi;