-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
130 lines (117 loc) · 3.07 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# This file is a template, and might need editing before it works on your project.
# Build a Docker image with CI/CD and push to the GitLab registry.
# Docker-in-Docker documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
#
# This template uses one generic job with conditional builds
# for the default branch and all other (MR) branches.
stages:
- build
- deploy
# test-build:
# tags:
# - docker
# stage: build
# image: tmaier/docker-compose:latest
# services:
# - docker:dind
# script:
# - docker ps
# - docker-compose -f docker/docker-compose.prod.yml down
build client:
# Use the official docker image
image: tmaier/docker-compose:latest
tags:
- docker
stage: build
only:
changes:
- client/**/*
refs:
- prod
services:
- docker:dind
before_script:
- echo "$CI_REG_TOKEN" | docker login --username "$CI_REG_USERNAME" --password-stdin $CI_REGISTRY
script:
- cd client && docker build -t registry.gitlab.com/iecse-manipal/board-20/prometheus-21/hawkeye-2021/hawk-client:latest -f client.prod.Dockerfile .
- docker push registry.gitlab.com/iecse-manipal/board-20/prometheus-21/hawkeye-2021/hawk-client:latest
after_script:
- docker logout $CI_REGISTRY
build api:
# Use the official docker image.
image: tmaier/docker-compose:latest
tags:
- docker
stage: build
only:
changes:
- api/**/*
refs:
- prod
services:
- docker:dind
before_script:
- echo "$CI_REG_TOKEN" | docker login --username "$CI_REG_USERNAME" --password-stdin $CI_REGISTRY
script:
- cd api && docker build -t registry.gitlab.com/iecse-manipal/board-20/prometheus-21/hawkeye-2021/hawk-api:latest -f api.prod.Dockerfile .
- docker push registry.gitlab.com/iecse-manipal/board-20/prometheus-21/hawkeye-2021/hawk-api:latest
deploy api:
stage: deploy
only:
changes:
- api/**/*
refs:
- prod
tags:
- shell
before_script:
- echo "$CI_REG_TOKEN" | sudo docker login --username "$CI_REG_USERNAME" --password-stdin $CI_REGISTRY
script:
- ./deploy/api-deploy.sh
after_script:
- docker logout $CI_REGISTRY
when: manual
deploy client:
stage: deploy
only:
changes:
- client/**/*
refs:
- prod
tags:
- shell
before_script:
- echo "$CI_REG_TOKEN" | sudo docker login --username "$CI_REG_USERNAME" --password-stdin $CI_REGISTRY
script:
- ./deploy/client-deploy.sh
after_script:
- docker logout $CI_REGISTRY
when: manual
deploy docker:
stage: deploy
only:
changes:
- docker/docker-compose.prod.yml
refs:
- prod
tags:
- shell
before_script:
- echo "$CI_REG_TOKEN" | sudo docker login --username "$CI_REG_USERNAME" --password-stdin $CI_REGISTRY
script:
- sudo docker-compose -f docker/docker-compose.prod.yml up -d
after_script:
- docker logout $CI_REGISTRY
when: manual
# deploy shell changes:
# stage: deploy
# only:
# changes:
# - deploy/**/*
# refs:
# - prod
# tags:
# - shell
# script:
# - git pull origin prod
# when: manual