-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
172 lines (161 loc) · 4.97 KB
/
.drone.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
---
kind: pipeline
type: kubernetes
name: default
steps:
- name: restore
image: plugins/s3-cache
settings:
pull: true
endpoint:
from_secret: s3_cache_endpoint
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
root:
from_secret: s3_bucket
restore: true
filename: cache.tar.gz # Use compression
- name: compile-scala
image: eed3si9n/sbt:jdk11-alpine
commands:
- sbt -Duser.home=. -Dsbt.global.base=.sbt -Dsbt.boot.directory=.sbt -Dsbt.ivy.home=.ivy2 ";compile"
depends_on:
- restore
- name: build-scala
image: eed3si9n/sbt:jdk11-alpine
commands:
- sbt -Duser.home=. -Dsbt.global.base=.sbt -Dsbt.boot.directory=.sbt -Dsbt.ivy.home=.ivy2 ";assembly"
depends_on:
- compile-scala
- name: compile-js
image: eed3si9n/sbt:jdk11-alpine
commands:
- sbt -Duser.home=. -Dsbt.global.base=.sbt -Dsbt.boot.directory=.sbt -Dsbt.ivy.home=.ivy2 ";frontend/fullOptJS"
depends_on:
- compile-scala
- name: build-js
image: node:current-alpine
commands:
- cd frontend
- yarn install
- CI=false yarn run build
depends_on:
- compile-js
- name: rebuild
image: plugins/s3-cache
settings:
pull: true
endpoint:
from_secret: s3_cache_endpoint
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
root:
from_secret: s3_bucket
rebuild: true
filename: cache.tar.gz # Use compression
mount:
- frontend/node_modules
- .sbt
- .cache
- .ivy2/cache
- backend/target
- frontend/target
- common/.js
- common/.jvm
- project/target
when:
event: push
depends_on:
- build-js
- build-scala
- name: push-frontend
image: docker:dind
environment:
DOCKER_USER:
from_secret: ghcr_login
DOCKER_PASSWORD:
from_secret: ghcr_password
volumes:
- name: dockersock
path: /var/run/
commands:
- export SANITIZED_DRONE_COMMIT_BRANCH=$(echo ${DRONE_COMMIT_BRANCH} | sed 's#/#-#g')
- export COMMIT_SHA=${DRONE_COMMIT_SHA:0:7}
- cd frontend
- docker build -t ghcr.io/greg2010/athena-frontend .
- docker tag ghcr.io/greg2010/athena-frontend ghcr.io/greg2010/athena-frontend:$SANITIZED_DRONE_COMMIT_BRANCH\_$COMMIT_SHA
- docker tag ghcr.io/greg2010/athena-frontend ghcr.io/greg2010/athena-frontend:$SANITIZED_DRONE_COMMIT_BRANCH\_latest
- docker tag ghcr.io/greg2010/athena-frontend ghcr.io/greg2010/athena-frontend:latest
- docker login ghcr.io -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker push ghcr.io/greg2010/athena-frontend:$SANITIZED_DRONE_COMMIT_BRANCH\_$COMMIT_SHA
- docker push ghcr.io/greg2010/athena-frontend:$SANITIZED_DRONE_COMMIT_BRANCH\_latest
- docker push ghcr.io/greg2010/athena-frontend:latest
depends_on:
- build-js
- build-scala
- name: push-backend
image: docker:dind
environment:
DOCKER_USER:
from_secret: ghcr_login
DOCKER_PASSWORD:
from_secret: ghcr_password
volumes:
- name: dockersock
path: /var/run/
commands:
- export SANITIZED_DRONE_COMMIT_BRANCH=$(echo ${DRONE_COMMIT_BRANCH} | sed 's#/#-#g')
- export COMMIT_SHA=${DRONE_COMMIT_SHA:0:7}
- cd backend
- docker build -t ghcr.io/greg2010/athena-backend .
- docker tag ghcr.io/greg2010/athena-backend ghcr.io/greg2010/athena-backend:$SANITIZED_DRONE_COMMIT_BRANCH\_$COMMIT_SHA
- docker tag ghcr.io/greg2010/athena-backend ghcr.io/greg2010/athena-backend:$SANITIZED_DRONE_COMMIT_BRANCH\_latest
- docker tag ghcr.io/greg2010/athena-backend ghcr.io/greg2010/athena-backend:latest
- docker login ghcr.io -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker push ghcr.io/greg2010/athena-backend:$SANITIZED_DRONE_COMMIT_BRANCH\_$COMMIT_SHA
- docker push ghcr.io/greg2010/athena-backend:$SANITIZED_DRONE_COMMIT_BRANCH\_latest
- docker push ghcr.io/greg2010/athena-backend:latest
depends_on:
- build-scala
- name: flush
image: plugins/s3-cache
settings:
pull: true
endpoint:
from_secret: s3_cache_endpoint
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
root:
from_secret: s3_bucket
flush: true
filename: cache.tar.gz # Use compression
flush_age: 14
depends_on:
- rebuild
- name: discord-notify
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
depends_on:
- push-frontend
- push-backend
when:
status:
- failure
- success
volumes:
- name: dockersock
host:
path: /var/run/
---
kind: signature
hmac: d1ddde0c3539a41742e208da35ca174991354c3385ea025f7458f708504213b5