-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
89 lines (77 loc) · 2.3 KB
/
build.gradle
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
task testBackend(type:Exec) {
workingDir './backend'
commandLine 'lein', 'test'
}
task testFrontend(type:Exec) {
workingDir './frontend'
commandLine 'yarn', 'test-run'
}
task testAll {
dependsOn tasks.testBackend
dependsOn tasks.testFrontend
}
task buildBackendUberJar(type:Exec) {
dependsOn tasks.testBackend
workingDir './backend'
commandLine 'lein', 'do', 'clean,', 'ring', 'uberjar'
}
task buildBackendContainer(type:Exec) {
dependsOn tasks.buildBackendUberJar
workingDir './backend'
commandLine 'docker', 'build', '-t', 'keeponherdin-backend', '.'
}
task buildFrontendContainer(type:Exec) {
dependsOn tasks.testFrontend
workingDir './frontend'
commandLine 'docker', 'build', '-t', 'keeponherdin-frontend', '.'
}
task buildAllContainers {
dependsOn tasks.buildBackendContainer
dependsOn tasks.buildFrontendContainer
}
task pushBackend {
dependsOn tasks.buildBackendContainer
doLast {
exec {
commandLine 'docker', 'tag', 'keeponherdin-backend:latest', DOCKER_REPO_URL + 'keeponherdin-backend:latest'
}
exec {
commandLine 'docker', 'push', DOCKER_REPO_URL + 'keeponherdin-backend:latest'
}
}
}
task pushFrontend {
dependsOn tasks.buildFrontendContainer
doLast {
exec {
commandLine 'docker', 'tag', 'keeponherdin-frontend:latest', DOCKER_REPO_URL + 'keeponherdin-frontend:latest'
}
exec {
commandLine 'docker', 'push', DOCKER_REPO_URL + 'keeponherdin-frontend:latest'
}
}
}
task pushAll {
dependsOn tasks.pushBackend
dependsOn tasks.pushFrontend
}
task deployBackend {
dependsOn tasks.pushBackend
doLast {
exec {
commandLine 'gcloud', 'run', 'deploy', 'keeponherdin-backend', '--image', DOCKER_REPO_URL + 'keeponherdin-backend', '--region', 'us-central1', '--port', '8000', '--allow-unauthenticated'
}
}
}
task deployFrontend {
dependsOn tasks.pushFrontend
doLast {
exec {
commandLine 'gcloud', 'run', 'deploy', 'keeponherdin-frontend', '--image', DOCKER_REPO_URL + 'keeponherdin-frontend', '--region', 'us-central1', '--port', '80', '--allow-unauthenticated'
}
}
}
task deployAll {
dependsOn tasks.deployFrontend
dependsOn tasks.deployBackend
}