-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwercker.yml
162 lines (139 loc) · 4.83 KB
/
wercker.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
box: node:7.8.0
build-backend:
steps:
- script:
name: create tag
code: |
export BUILD_TAG=${WERCKER_GIT_COMMIT:0:9}
- script:
name: echo nodejs information
code: |
echo "node version $(node -v) running"
echo "npm version $(npm -v) running"
echo "npm registry $(npm config get registry)"
- script:
name: set yarn cache
code: |
export YARN_CACHE=$WERCKER_CACHE_DIR/yarn
- script:
name: run yarn
cwd: backend/
code: |
HOME=$YARN_CACHE yarn install --ignore-optional
# - script:
# name: node security project
# cwd: backend/
# code: |
# npm run nsp
- script:
name: update version file
cwd: backend/
code: |
echo $BUILD_TAG > version-tag
- internal/docker-push:
username: $DOCKER_REGISTRY_USERNAME
password: $DOCKER_REGISTRY_PASSWORD
repository: turistforeningen/ratatoskr
registry: https://registry.hub.docker.com/v2
tag: backend-$BUILD_TAG
working-dir: /pipeline/source
after-steps:
- turistforeningen/slack-notifier:
url: $SLACK_WEBHOOK_URL
pipeline: build-backend
build-assets:
steps:
- script:
name: create tag
code: |
export BUILD_TAG=${WERCKER_GIT_COMMIT:0:9}
- script:
name: export environment
code: |
export NODE_ENV=production
export NPM_CONFIG_LOGLEVEL=warn
- script:
name: set yarn cache
code: |
export YARN_CACHE=$WERCKER_CACHE_DIR/yarn
- script:
name: run yarn
cwd: frontend/
code: |
HOME=$YARN_CACHE yarn install --ignore-optional
- script:
name: run webpack
cwd: frontend/
code: |
npm run build:prod
- script:
name: copy to volume
code: |
mkdir -p /ratatoskr
cp -a -v /pipeline/source/build /ratatoskr
- internal/docker-push:
username: $DOCKER_REGISTRY_USERNAME
password: $DOCKER_REGISTRY_PASSWORD
repository: turistforeningen/ratatoskr
registry: https://registry.hub.docker.com/v2
tag: assets-$BUILD_TAG
after-steps:
- turistforeningen/slack-pipeline-notifier:
url: $SLACK_WEBHOOK_URL
pipeline: build-assets
deploy:
box:
id: alpine:3.4
cmd: /bin/sh
steps:
- script:
name: create tag
code: |
export BUILD_TAG=${WERCKER_GIT_COMMIT:0:9}
- script:
name: install tools
code: |
apk update
apk add python py-pip curl
# docker-cloud + requests 2.14 gives error "get_environ_proxies() takes exactly 2 arguments (1 given)"
pip install docker-cloud "requests==2.13.0"
- script:
name: docker stack update
code: |
pip install docker-cloud
docker-cloud service set --image turistforeningen/ratatoskr:assets-${BUILD_TAG} ratatoskr-assets --sync
docker-cloud service set --image turistforeningen/ratatoskr:backend-${BUILD_TAG} ratatoskr-backend --sync
docker-cloud service set --image turistforeningen/ratatoskr:backend-${BUILD_TAG} ratatoskr-native-backend --sync
docker-cloud service redeploy --not-reuse-volumes ratatoskr-assets ratatoskr-backend ratatoskr-native-backend --sync
after-steps:
- turistforeningen/slack-notifier:
url: $SLACK_WEBHOOK_URL
pipeline: deploy
deploy-beta:
box:
id: alpine:3.4
cmd: /bin/sh
steps:
- script:
name: create tag
code: |
export BUILD_TAG=${WERCKER_GIT_COMMIT:0:9}
- script:
name: install tools
code: |
apk update
apk add python py-pip curl
# docker-cloud + requests 2.14 gives error "get_environ_proxies() takes exactly 2 arguments (1 given)"
pip install docker-cloud "requests==2.13.0"
- script:
name: docker stack update
code: |
pip install docker-cloud
docker-cloud service set --image turistforeningen/ratatoskr:assets-${BUILD_TAG} ratatoskr-beta-assets --sync
docker-cloud service set --image turistforeningen/ratatoskr:backend-${BUILD_TAG} ratatoskr-beta-backend --sync
docker-cloud service set --image turistforeningen/ratatoskr:backend-${BUILD_TAG} ratatoskr-beta-native-backend --sync
docker-cloud service redeploy --not-reuse-volumes ratatoskr-beta-assets ratatoskr-beta-backend ratatoskr-beta-native-backend --sync
after-steps:
- turistforeningen/slack-notifier:
url: $SLACK_WEBHOOK_URL
pipeline: deploy