-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
200 lines (169 loc) · 6.49 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
buildscript {
ext {
springBootVersion = '2.3.1.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('org.asciidoctor:asciidoctor-gradle-plugin:1.5.10')
}
}
plugins {
id "org.asciidoctor.convert" version "1.5.10"
id 'org.hidetake.ssh' version '2.9.0'
id 'com.google.cloud.tools.jib' version '2.7.1'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.yapp.ios2'
version = '2.0.1-SNAPSHOT'
description = '90s'
sourceCompatibility = 15
ext {
snippetsDir = file('build/generated-snippets')
}
asciidoctor {
inputs.dir snippetsDir
// dependsOn test
setBackend("")
// outputDir './src/main/resources/static/docs'
doLast{
copy {
from "${asciidoctor.outputDir}/html5"
into './src/main/resources/static/docs'
}
}
}
bootJar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
//jib Setting
jib {
from {
image = 'openjdk:15'
}
to {
image = 'radiata03/90s'
tags = ["${project.version}".toString()]
}
container {
ports = ['8080']
volumes = ["/tmp", "/logs"]
}
}
task dockerImageBuildAndPush {
dependsOn asciidoctor
doFirst{
jibDockerBuild
}
doLast{
def command = "docker push radiata03/90s:" + "${project.version}".toString()
println "\n\$ ${command}"
execute(command, ignoreError:true){r->println r}
}
}
task docker90sServerRun{
dependsOn asciidoctor, jibBuildTar
doLast{
ssh.run {
session(remotes.deploy) {
def command
def imageName = "${project.properties['imageName']}:latest"
def containerName = '90s_test'
def host = project.properties['dockerHost']
def buildPath = fileTree(dir: 'build').getDir()
def tarName = "jib-image.tar"
def inPort = "8080"
def outPort = "8080"
def routePort = "9999"
def from = "${buildPath}/${tarName}"
def to = project.properties["dockerDir"]
// command = "ls ${to}"
// println "\n\$ ${command}"
// execute(command){r->println r}
command = "rm ${to}${tarName}"
println "\n\$ ${command}"
execute(command, ignoreError:true){r->println r}
println "\n\$ put from:${from}, into: ${to}"
put from: from, into: to
command = 'ls'
println "\n\$ ${command}"
execute(command){r->println r}
command = "docker stop ${containerName}"
println "\n\$ ${command}"
execute(command, ignoreError:true){r->println r}
command = "docker rm ${containerName}"
println "\n\$ ${command}"
execute command, ignoreError:true
// command = "docker rmi \$(docker images | grep ${imageName})"
// println "\n\$ ${command}"
// execute command, ignoreError:true
command = "docker load --input ${to}${tarName}"
println "\n\$ ${command}"
execute command, ignoreError:true
command = "docker images"
println "\n\$ ${command}"
execute command, ignoreError:true
command = "docker run -d --name=${containerName} -p ${inPort}:${outPort} -v /tmp/log:/logs --network 90s_network ${imageName}"
// docker run --name 90s_sub -p 8081:8080 -v /tmp/log:/logs --link mysql-docker radiata03/90s:2.0.1
println "\n\$ ${command}"
execute command, ignoreError:true
command = "docker ps"
println "\n\$ ${command}"
execute command, ignoreError:true
println('\n도커 업로드 완료')
}
}
}
}
remotes {
deploy {
role '90s server'
host = project.properties['dockerHost']
port = project.properties['dockerPort'].toInteger()
user = project.properties['dockerUser']
password = project.properties['dockerPassword']
knownHosts = allowAnyHosts
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.2.5.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc:2.2.5.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-jdbc:2.2.5.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-security:2.2.5.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-web:2.2.5.RELEASE'
implementation 'org.springframework.boot:spring-boot-configuration-processor:2.2.5.RELEASE'
implementation 'org.projectlombok:lombok:1.18.8'
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
implementation 'com.amazonaws:aws-java-sdk:1.11.753'
implementation 'com.amazonaws:aws-java-sdk-core:1.11.753'
implementation 'com.amazonaws:aws-java-sdk-s3:1.11.753'
implementation 'com.amazonaws:aws-java-sdk-sns:1.11.763'
implementation 'com.twilio.sdk:twilio:7.49.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.3'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.10.3'
implementation 'com.fasterxml.jackson.core:jackson-core:2.10.3'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'org.springframework.security:spring-security-test:5.2.2.RELEASE'
runtimeOnly 'org.springframework.boot:spring-boot-devtools:2.2.5.RELEASE'
runtimeOnly 'mysql:mysql-connector-java:8.0.19'
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
}