-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
43 lines (40 loc) · 1.39 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
before_script:
- echo "Building dpm"
- echo "============"
stages:
- build
build dpm for dev:
stage: build
environment: development
variables:
CI_BUILD_TAG: "dev"
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- ./build_image.sh "dev"
- docker push $CI_REGISTRY_IMAGE:$CI_BUILD_TAG
- docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD
- docker push dicehub/dpm:$CI_BUILD_TAG
only:
- dev
tags:
- image-builder
build dpm for production:
stage: build
environment: production
script:
- git branch -a --contains $CI_BUILD_REF
- if grep -q "master" <<< $(git branch -a --contains $CI_BUILD_REF);
then
echo "Build release image for production";
docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY;
./build_image.sh "$CI_BUILD_TAG";
docker push $CI_REGISTRY_IMAGE:$CI_BUILD_TAG;
docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD;
docker push dicehub/dpm:$CI_BUILD_TAG;
else
echo "Tag is not from master branch. Image will not be deployed for production";
fi
only:
- /^v?[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-.]+)?$/
tags:
- image-builder