-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
38 lines (32 loc) · 926 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
image: docker:dind
variables:
CONTAINER_TEST_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
CONTAINER_RELEASE_IMAGE: "$CI_REGISTRY_IMAGE:latest"
CONTAINER_TAGGED_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
stages:
- build
- release
before_script:
- docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
build:
stage: build
script:
- docker build --pull -t "$CONTAINER_TEST_IMAGE" .
- docker push "$CONTAINER_TEST_IMAGE"
release-image:
stage: release
script:
- docker pull "$CONTAINER_TEST_IMAGE"
- docker tag "$CONTAINER_TEST_IMAGE" "$CONTAINER_RELEASE_IMAGE"
- docker push "$CONTAINER_RELEASE_IMAGE"
only:
- master
tagged-image:
stage: release
script:
- docker pull "$CONTAINER_TEST_IMAGE"
- docker tag "$CONTAINER_TEST_IMAGE" "$CONTAINER_TAGGED_IMAGE"
- docker push "$CONTAINER_TAGGED_IMAGE"
only:
- tags