-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
119 lines (93 loc) · 2.54 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
stages:
- test
- build
- docker
- deploy
test_job:
stage: test
image: valentineus/meteor:build
tags:
- docker
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules
variables:
GIT_SUBMODULE_STRATEGY: "recursive"
NODE_ENV: "development"
TEST_CLIENT: "0"
TEST_SERVER: "1"
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
- apt-get update && apt-get --yes install procps
- meteor reset && meteor npm install
script:
- meteor npm run lint
- meteor npm run test -- --once
build_job:
stage: build
image: valentineus/meteor:build
only:
- master
tags:
- docker
artifacts:
paths:
- build
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules
variables:
GIT_SUBMODULE_STRATEGY: "recursive"
NODE_ENV: "development"
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
- apt-get update && apt-get --yes install procps
- meteor reset && meteor npm install
script:
- meteor npm run lint && meteor npm run test -- --once
- meteor build --architecture "os.linux.x86_64" --directory "./build" --server-only
- cd "./build/bundle/programs/server" && meteor npm install
docker_job:
stage: docker
image: docker:stable
services:
- docker:dind
only:
- master
tags:
- docker
artifacts:
paths:
- build
before_script:
- docker login --username "$(printenv GITLAB_USERNAME)" --password "$(printenv GITLAB_PASSWORD)" registry.styleschool.ru
script:
- docker build --tag "$(printenv GITLAB_REPOSITORY)" "./"
- docker push "$(printenv GITLAB_REPOSITORY)"
deploy_job:
stage: deploy
only:
- master
tags:
- hetzner
before_script:
- docker rm --force "$(printenv CONTAINER_NAME)"
- docker login --username "$(printenv GITLAB_USERNAME)" --password "$(printenv GITLAB_PASSWORD)" registry.styleschool.ru
script:
- docker pull "$(printenv GITLAB_REPOSITORY)"
- docker run --detach --restart=always
--env "B24_DOMAIN=$(printenv B24_DOMAIN)"
--env "B24_TOKEN=$(printenv B24_TOKEN)"
--env "B24_USERID=$(printenv B24_USERID)"
--env "MONGO_URL=$(printenv MONGO_URL)"
--env "ROOT_URL=$(printenv API_URL)"
--env "V1_TOKEN=$(printenv V1_TOKEN)"
--env "VK_CONFKEY=$(printenv VK_CONFKEY)"
--env "VK_TOKEN=$(printenv VK_TOKEN)"
--name "$(printenv CONTAINER_NAME)"
--publish "$(printenv PORT):3000"
"$(printenv GITLAB_REPOSITORY)"