-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
42 lines (39 loc) · 1.18 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
# will never run on a git push or merge request event.
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- when: always
variables:
FULL_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA-$CI_PIPELINE_ID
stages:
- build
- deploy
build:
stage: build
tags:
- shell
script:
- "docker build --no-cache -t $FULL_IMAGE ubuntu"
deploy:
stage: deploy
tags:
- shell
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
- echo "$DH_PW" | docker login -u $DH_USER --password-stdin
after_script:
- docker logout $CI_REGISTRY
- docker logout
script:
- "docker tag $FULL_IMAGE $CI_REGISTRY_IMAGE:ubuntu"
- "docker tag $FULL_IMAGE $CI_REGISTRY_IMAGE:latest"
- "docker tag $FULL_IMAGE cmptstks/baseimage:ubuntu"
- "docker tag $FULL_IMAGE cmptstks/baseimage:latest"
- "docker push $FULL_IMAGE"
- "docker push $CI_REGISTRY_IMAGE:ubuntu"
- "docker push $CI_REGISTRY_IMAGE:latest"
- "docker push cmptstks/baseimage:ubuntu"
- "docker push cmptstks/baseimage:latest"