-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
38 lines (34 loc) · 997 Bytes
/
.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
stages:
- publish
- publish-release
variables:
#TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
#TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
TAG_LATEST: $CI_REGISTRY_IMAGE:latest
TAG_COMMIT: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
TAG_DATE: $CI_REGISTRY_IMAGE:CI_COMMIT_TIMESTAMP
# GIT_SUBMODULE_STRATEGY: recursive
publish:
image: docker:latest
stage: publish
services:
- docker:dind
script:
- ls -lah
- echo TAG_COMMIT
- echo TAG_DATE
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push $TAG_COMMIT
- docker push $TAG_LATEST
publish-release:
only:
- release
image: docker:latest
stage: publish-release
services:
- docker:dind
script:
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE:CI_COMMIT_TAG