-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
189 lines (173 loc) · 6.45 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# BASE
# https://docs.gitlab.com/ce/ci/docker/using_docker_build.html#container-registry-examples
stages:
- test
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
###############################################################################
## ENTITY MANAGER DOCKER
###############################################################################
test:
image: node:12
stage: test
tags:
- vocdoni
cache:
paths:
- node_modules
policy: push
before_script:
- npm i
script:
- npm test
manager-build:
image: node:12
stage: build
tags:
- vocdoni
script:
- npm install
- npm run export
#artifacts:
# name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
# paths:
# - build/
except:
- master
- release
cache:
paths:
- node_modules
policy: pull
manager-docker:
stage: build
tags:
- vocdoni
image: docker:stable
services:
- docker:dind
script:
# Gitlab CI
# - docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
# - docker build --pull -t ${MANAGER_RELEASE_IMAGE} --build-arg "BOOTNODES_URL_READ_ONLY=$BOOTNODES_URL_READ_ONLY" --build-arg "ETH_NETWORK_ID=$ETH_NETWORK_ID" -f Dockerfile .
# - docker push ${MANAGER_RELEASE_IMAGE}
#
# Docker Hub
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
# Plain image
- docker build -t ${CI_REGISTRY_IMAGE}:latest --build-arg "ETH_NETWORK_ID=$ETH_NETWORK_ID" --build-arg "BOOTNODES_URL_READ_ONLY=$BOOTNODES_URL_READ_ONLY" --build-arg "BOOTNODES_URL_RW=$BOOTNODES_URL_RW" --build-arg "APP_LINKING_DOMAIN=$APP_LINKING_DOMAIN" --build-arg "REGISTER_URL=$REGISTER_URL" --build-arg "ACTION_VISIBILITY_URL=$ACTION_VISIBILITY_URL" --build-arg "MANAGER_BACKEND_URI=$MANAGER_BACKEND_URI" --build-arg "MANAGER_BACKEND_PUB_KEY=$MANAGER_BACKEND_PUB_KEY" .
- docker push ${CI_REGISTRY_IMAGE}:latest
# Nginx runtime image
- docker build --target nginx-runtime -t ${CI_REGISTRY_IMAGE}:nginx-latest --build-arg "ETH_NETWORK_ID=$ETH_NETWORK_ID" --build-arg "BOOTNODES_URL_READ_ONLY=$BOOTNODES_URL_READ_ONLY" --build-arg "BOOTNODES_URL_RW=$BOOTNODES_URL_RW" --build-arg "APP_LINKING_DOMAIN=$APP_LINKING_DOMAIN" --build-arg "REGISTER_URL=$REGISTER_URL" --build-arg "ACTION_VISIBILITY_URL=$ACTION_VISIBILITY_URL" --build-arg "MANAGER_BACKEND_URI=$MANAGER_BACKEND_URI" --build-arg "MANAGER_BACKEND_PUB_KEY=$MANAGER_BACKEND_PUB_KEY" .
- docker push ${CI_REGISTRY_IMAGE}:nginx-latest
# GitHub
- docker login -u ${GH_REGISTRY_USER} -p ${GH_REGISTRY_PASSWORD} ${GH_REGISTRY}
# Plain image
- docker tag ${CI_REGISTRY_IMAGE}:latest ${GH_REGISTRY_IMAGE}:latest
- docker push ${GH_REGISTRY_IMAGE}:latest
# Nginx runtime image
- docker tag ${CI_REGISTRY_IMAGE}:nginx-latest ${GH_REGISTRY_IMAGE}:nginx-latest
- docker push ${GH_REGISTRY_IMAGE}:nginx-latest
only:
changes:
- components/**/*
- i18n/**/*
- lib/**/*
- pages/**/*
- public/**/*
- styles/**/*
- Dockerfile-live
- .dockerignore
- .gitlab-ci.yml
- env-config.js
- next.config.js
- package-lock.json
- package.json
- tsconfig.json
refs:
- master
manager-docker-release:
stage: build
tags:
- vocdoni
image: docker:stable
services:
- docker:dind
script:
# Gitlab CI
# - docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
# - docker build --pull -t ${MANAGER_RELEASE_IMAGE} --build-arg "BOOTNODES_URL_READ_ONLY=$BOOTNODES_URL_READ_ONLY" --build-arg "ETH_NETWORK_ID=$ETH_NETWORK_ID" -f Dockerfile .
# - docker push ${MANAGER_RELEASE_IMAGE}
#
# Docker Hub
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
# Plain image
- docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME} --build-arg "ETH_NETWORK_ID=$ETH_NETWORK_ID" --build-arg "BOOTNODES_URL_READ_ONLY=$BOOTNODES_URL_READ_ONLY" --build-arg "BOOTNODES_URL_RW=$BOOTNODES_URL_RW" --build-arg "APP_LINKING_DOMAIN=$APP_LINKING_DOMAIN" --build-arg "REGISTER_URL=$REGISTER_URL" --build-arg "ACTION_VISIBILITY_URL=$ACTION_VISIBILITY_URL" --build-arg "MANAGER_BACKEND_URI=$MANAGER_BACKEND_URI" --build-arg "MANAGER_BACKEND_PUB_KEY=$MANAGER_BACKEND_PUB_KEY" .
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
# Nginx runtime image
- docker build --target nginx-runtime -t ${CI_REGISTRY_IMAGE}:nginx-${CI_COMMIT_REF_NAME} --build-arg "ETH_NETWORK_ID=$ETH_NETWORK_ID" --build-arg "BOOTNODES_URL_READ_ONLY=$BOOTNODES_URL_READ_ONLY" --build-arg "BOOTNODES_URL_RW=$BOOTNODES_URL_RW" --build-arg "APP_LINKING_DOMAIN=$APP_LINKING_DOMAIN" --build-arg "REGISTER_URL=$REGISTER_URL" --build-arg "ACTION_VISIBILITY_URL=$ACTION_VISIBILITY_URL" --build-arg "MANAGER_BACKEND_URI=$MANAGER_BACKEND_URI" --build-arg "MANAGER_BACKEND_PUB_KEY=$MANAGER_BACKEND_PUB_KEY" .
- docker push ${CI_REGISTRY_IMAGE}:nginx-${CI_COMMIT_REF_NAME}
# GitHub
- docker login -u ${GH_REGISTRY_USER} -p ${GH_REGISTRY_PASSWORD} ${GH_REGISTRY}
# Plain image
- docker tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME} ${GH_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
- docker push ${GH_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
# Nginx runtime image
- docker tag ${CI_REGISTRY_IMAGE}:nginx-${CI_COMMIT_REF_NAME} ${GH_REGISTRY_IMAGE}:nginx-${CI_COMMIT_REF_NAME}
- docker push ${GH_REGISTRY_IMAGE}:nginx-${CI_COMMIT_REF_NAME}
only:
changes:
- components/**/*
- i18n/**/*
- lib/**/*
- pages/**/*
- public/**/*
- styles/**/*
- Dockerfile-live
- .dockerignore
- .gitlab-ci.yml
- env-config.js
- next.config.js
- package-lock.json
- package.json
- tsconfig.json
refs:
- master
- release
- /^release-.*$/
- stage
## PREVIEW
# pages:
# stage: preview
# image: alpine:latest
# environment: staging
# script:
# - cp -a ./build ./public
# artifacts:
# paths:
# - public
# except:
# - master
# review:
# stage: deploy
# image: alpine:latest
# script:
# - echo "Deploy to review server"
# environment:
# name: review/$CI_COMMIT_REF_NAME
# # url: https://$CI_ENVIRONMENT_SLUG.example.com/
# except:
# - master
## DELIVERY
# variables:
# S3_BUCKET_NAME: "yourbucket"
# deploy to production:
# environment: production
# image: python:latest
# script:
# - pip install awscli
# - aws s3 cp ./ s3://$S3_BUCKET_NAME/ --recursive --exclude "*" --include "*.html"
# only:
# - master