-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
49 lines (35 loc) · 1.1 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
44
45
46
47
48
49
variables:
###################### orginal
COMMIT: $CI_BUILD_REF
REPO: rotoro
REPO_DEV: webapp_staging
DEV_LOCAL_REGISTY: staging-workload:443
PROD_CLOUD_REGISTY: gcr.io
######################
image: docker:stable
services:
- name: docker:18-dind
stages:
- build
- release
build:
stage: build
before_script:
- docker login -u${repo_user} -p${repo_pass} ${DEV_LOCAL_REGISTY}
script:
- set -e
- chmod +x ./script/build.sh;
- ./script/build.sh;
- docker tag ${REPO}:${COMMIT} ${DEV_LOCAL_REGISTY}/${REPO_DEV}:${COMMIT}
- docker push ${DEV_LOCAL_REGISTY}/${REPO_DEV}:${COMMIT}
release:
stage: release
before_script:
- docker login -u${repo_user} -p${repo_pass} ${DEV_LOCAL_REGISTY}
script:
- set -e
- docker pull ${DEV_LOCAL_REGISTY}/${REPO_DEV}:${COMMIT}
- docker tag ${DEV_LOCAL_REGISTY}/${REPO_DEV}:${COMMIT} ${PROD_CLOUD_REGISTY}/${gcp_prg}/webapp:latest
- echo ${gcp_service_key} | docker login -u _json_key --password-stdin https://${PROD_CLOUD_REGISTY}
- docker push ${PROD_CLOUD_REGISTY}/${gcp_prg}/webapp:latest
when: manual