corda/docker/build.gradle

64 lines
2.0 KiB
Groovy
Raw Normal View History

evaluationDependsOn(":node:capsule")
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-docker-plugin:3.4.4'
}
}
import com.bmuschko.gradle.docker.DockerRemoteApiPlugin
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
apply plugin: 'kotlin'
apply plugin: DockerRemoteApiPlugin
apply plugin: 'application'
// We need to set mainClassName before applying the shadow plugin.
mainClassName = 'net.corda.core.ConfigExporterMain'
apply plugin: 'com.github.johnrengelman.shadow'
dependencies{
compile project(':node')
}
shadowJar {
baseName = 'config-exporter'
classifier = null
version = null
zip64 true
}
task buildDockerFolder(dependsOn: [":node:capsule:buildCordaJAR", shadowJar]) {
doLast {
def cordaJar = project(":node:capsule").buildCordaJAR.archivePath
project.copy {
into new File(project.buildDir, "docker-temp")
from "src/bash/run-corda.sh"
from cordaJar
from shadowJar.archivePath
from "src/config/starting-node.conf"
from "src/bash/generate-config.sh"
from "src/docker/Dockerfile"
rename(cordaJar.name, "corda.jar")
rename(shadowJar.archivePath.name, "config-exporter.jar")
}
}
}
task buildOfficialDockerImage(type: DockerBuildImage, dependsOn: [buildDockerFolder]) {
final String runTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
//if we are a snapshot, append a timestamp
//if we are a release, append RELEASE
final String suffix = project.version.toString().toLowerCase().contains("snapshot") ? runTime : "RELEASE"
inputDir = new File(project.buildDir, "docker-temp")
tags = ["corda/corda-${project.version.toString().toLowerCase()}:${suffix}", "corda/corda-${project.version.toString().toLowerCase()}:latest"]
}