mirror of
https://github.com/google/nomulus
synced 2026-02-09 06:20:29 +00:00
This CL adds two ways to build an docker image with gradle: 1) Adds a :proxy:deployJar task that builds an uber jar that contains all runtime dependencies. The jar can then be add to a docker image by calling docker with the added Dockerfile. The base image for this image can be both distroless java or openjdk:alpine. 2) Uses the Gradle distribution plugin to build a distribution tar file that contains all dependencies (as separate jar files) and a run script that sets up the classpath before calling the main class. Then the docker application plugin can build a docker image (with the dockerBuildImage task) using the application tar file. This only works with openjdk:alpline base image as the distroless java image does not contain a shell and therefore the script created by the distribution plugin cannot be launched. We may later decide to use one of the method and remove the other. Also adds an outcast test pattern that caused the tests to be flaky. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=222145192
104 lines
3.8 KiB
Groovy
104 lines
3.8 KiB
Groovy
apply plugin: 'com.google.osdetector'
|
|
apply plugin: 'application'
|
|
apply plugin: 'com.bmuschko.docker-java-application'
|
|
|
|
// TODO(jianglai): use plugins block once the osdetctor v1.6.0 works with it.
|
|
// see: https://github.com/google/osdetector-gradle-plugin/issues/15
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0'
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
resources {
|
|
exclude "${project.relativePath}/terraform/"
|
|
exclude "${project.relativePath}/kubernetes/"
|
|
}
|
|
}
|
|
}
|
|
|
|
mainClassName = 'google.registry.proxy.ProxyServer'
|
|
|
|
task deployJar(type: Jar) {
|
|
manifest {
|
|
attributes 'Main-Class': 'google.registry.proxy.ProxyServer'
|
|
}
|
|
baseName = 'proxy_server'
|
|
version = null
|
|
from {
|
|
configurations.runtimeClasspath.collect {
|
|
it.isDirectory() ? it : zipTree(it)
|
|
}
|
|
}
|
|
// Excludes signature files that accompany some dependency jars, like
|
|
// bonuncycastle. It they are present, only classes from those signed jars are
|
|
// made available to the class loader.
|
|
// see https://discuss.gradle.org/t/signing-a-custom-gradle-plugin-thats-downloaded-by-the-build-system-from-github/1365
|
|
exclude "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA"
|
|
with jar
|
|
}
|
|
|
|
dependencies {
|
|
compile 'com.beust:jcommander:1.48'
|
|
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.9'
|
|
compile 'com.fasterxml.jackson.core:jackson-core:2.9.6'
|
|
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.9'
|
|
compile 'com.google.api-client:google-api-client:1.27.0'
|
|
compile 'com.google.api-client:google-api-client:1.27.0'
|
|
compile 'com.google.apis:google-api-services-cloudkms:v1-rev12-1.22.0'
|
|
compile 'com.google.apis:google-api-services-monitoring:v3-rev11-1.22.0'
|
|
compile 'com.google.apis:google-api-services-storage:v1-rev86-1.22.0'
|
|
compile 'com.google.auto.value:auto-value-annotations:1.6.2'
|
|
compile 'com.google.code.findbugs:jsr305:3.0.2'
|
|
compile 'com.google.dagger:dagger:2.15'
|
|
compile 'com.google.flogger:flogger:0.1'
|
|
compile 'com.google.guava:guava:27.0-jre'
|
|
compile 'com.google.http-client:google-http-client:1.27.0'
|
|
compile 'com.google.monitoring-client:metrics:1.0.4'
|
|
compile 'com.google.monitoring-client:stackdriver:1.0.4'
|
|
compile 'io.netty:netty-buffer:4.1.31.Final'
|
|
compile 'io.netty:netty-codec-http:4.1.31.Final'
|
|
compile 'io.netty:netty-codec:4.1.31.Final'
|
|
compile 'io.netty:netty-common:4.1.31.Final'
|
|
compile 'io.netty:netty-handler:4.1.31.Final'
|
|
compile 'io.netty:netty-transport:4.1.31.Final'
|
|
compile 'javax.inject:javax.inject:1'
|
|
compile 'joda-time:joda-time:2.3'
|
|
compile 'org.bouncycastle:bcpkix-jdk15on:1.52'
|
|
compile 'org.bouncycastle:bcprov-jdk15on:1.52'
|
|
compile project(':util')
|
|
|
|
runtime 'com.google.flogger:flogger-system-backend:0.1'
|
|
runtime 'com.google.auto.value:auto-value:1.6.2'
|
|
runtime group: 'io.netty', name: 'netty-tcnative-boringssl-static',
|
|
version: '2.0.20.Final', classifier: osdetector.classifier
|
|
|
|
testCompile 'com.google.monitoring-client:contrib:1.0.4'
|
|
testCompile 'com.google.truth:truth:0.42'
|
|
testCompile 'org.yaml:snakeyaml:1.17'
|
|
testCompile 'junit:junit:4.12'
|
|
testCompile 'org.mockito:mockito-all:1.9.5'
|
|
testCompile project(':third_party')
|
|
testCompile project(path: ':core', configuration: 'testRuntime')
|
|
|
|
// Include auto-value in compile until nebula-lint understands
|
|
// annotationProcessor
|
|
annotationProcessor 'com.google.auto.value:auto-value:1.6.2'
|
|
testAnnotationProcessor 'com.google.auto.value:auto-value:1.6.2'
|
|
annotationProcessor 'com.google.dagger:dagger-compiler:2.15'
|
|
testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.15'
|
|
}
|
|
|
|
docker {
|
|
javaApplication {
|
|
// TODO(jianglai): Peg to a specific hash to enable reproducible build.
|
|
baseImage = 'openjdk:8-jre-alpine'
|
|
ports = [30000, 30001, 30002, 30011, 30012]
|
|
}
|
|
}
|