-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
76 lines (68 loc) · 1.52 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
image: node:10.9.0
stages:
- prep
- build
- build_docker
- deploy
cache:
paths:
- node_modules/
prep:
stage: prep
script:
- yarn install
artifacts:
paths:
- node_modules
only:
- master
build:
stage: build
dependencies:
- prep
script:
- yarn run build
artifacts:
paths:
- public/
only:
- master
build_docker:
stage: build_docker
image: docker:stable
dependencies:
- build
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --pull -t $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME .
- docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
- docker tag $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
only:
- master
deploy_production:
stage: deploy
dependencies:
- build_docker
image: docker:latest
variables:
DOCKER_HOST: tcp://radon.elementarium.xyz:2376
DOCKER_TLS_VERIFY: 1
SERVICE_NAME: stellar
artifacts:
paths:
- dist/
script:
- mkdir -p ~/.docker
- echo "$TLSCACERT" > ~/.docker/ca.pem
- echo "$TLSCERT" > ~/.docker/cert.pem
- echo "$TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
- docker stack deploy --with-registry-auth --compose-file=docker/production-stack.yml ${CI_PROJECT_NAMESPACE}-${CI_PROJECT_NAME}-${SERVICE_NAME}
environment:
name: prod
url: https://stellar-framework.com
only:
- master