-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
106 lines (91 loc) · 3.16 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
buildscript {
ext {
springBootVersion = '2.2.6.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'com.bmuschko:gradle-docker-plugin:3.4.1'
}
}
plugins {
id 'com.bmuschko.docker-remote-api' version '3.4.1'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
group = 'com.apptastic'
version = '0.1.0-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
repositories {
mavenCentral()
jcenter()
maven {
url 'https://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-mongodb-reactive')
compile('org.twitter4j:twitter4j-core:4.0.7')
compile('com.apptastic:insynsregistret:3.0.4')
compile('com.apptastic:mfsapdmr:1.1.2')
compile('com.apptastic:blankningsregistret:3.0.9')
compile('com.apptastic:repurchase:1.0.2')
compile('com.apptastic:rssreader:2.3.1')
compile('com.apptastic:tickersymbol:2.0.11')
compile('org.apache.commons:commons-lang3:3.8.1')
compile('com.googlecode.json-simple:json-simple:1.1.1')
testCompile('com.aries:docker-java-shaded:3.0.14')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
docker {
registryCredentials {
username = getConfigurationProperty('DOCKER_USERNAME', 'docker.username')
password = getConfigurationProperty('DOCKER_PASSWORD', 'docker.password')
email = getConfigurationProperty('DOCKER_EMAIL', 'docker.email')
}
}
String getConfigurationProperty(String envVar, String sysProp) {
System.getenv(envVar) ?: project.findProperty(sysProp)
}
task copyReport(type: Copy) {
from file("${buildDir}/reports/my-report.pdf")
into file("${buildDir}/toArchive")
}
task createDockerfile(type: Dockerfile) {
destFile = project.file('build/docker/Dockerfile')
from 'openjdk:11-jre-slim'
maintainer 'Apptastic "apptastic.software@gmail.com"'
copyFile jar.archiveName, '/app/fininsyn.jar'
entryPoint 'java'
defaultCommand '-Djdk.tls.client.protocols=TLSv1.2', '-jar', '/app/fininsyn.jar'
//exposePort 8080
//runCommand 'apk --update --no-cache add curl'
//instruction 'HEALTHCHECK CMD curl -f http://localhost:8080/health || exit 1'
//runCommand 'apk add --no-cache tzdata'
//runCommand 'apt-get install tzdata'
environmentVariable('TZ', 'Europe/Stockholm')
}
task syncAppArchive(type: Sync) {
dependsOn assemble
from jar.archivePath
into createDockerfile.destFile.parentFile
}
task buildImage(type: DockerBuildImage) {
dependsOn createDockerfile
inputDir = createDockerfile.destFile.parentFile
tag = "w3stling/fininsyn:$jar.version"
}
task pushImage(type: DockerPushImage) {
dependsOn buildImage
conventionMapping.imageName = { buildImage.getTag() }
}