forked from solidnerd/docker-bookstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
27 lines (26 loc) · 882 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
stages:
- build
- test
- image
build:
stage: build
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME .
- docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
- docker rmi $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
release:
stage: image
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
- docker tag $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME $CI_REGISTRY_IMAGE:$(cat VERSION)
- docker push $CI_REGISTRY_IMAGE:$(cat VERSION)
- docker rmi $CI_REGISTRY_IMAGE:$(cat VERSION)
- docker tag $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
- docker rmi $CI_REGISTRY_IMAGE:latest
only:
- master