-
Notifications
You must be signed in to change notification settings - Fork 3k
/
build.gradle
55 lines (47 loc) · 1.55 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
plugins {
id 'com.palantir.docker'
id 'java' // required for versioning
}
apply from: "../../gradle/versioning/versioning.gradle"
ext {
docker_repo = 'datahub-elasticsearch-setup'
docker_dir = 'elasticsearch-setup'
}
docker {
name "${docker_registry}/${docker_repo}:v${version}"
version "v${version}"
dockerfile file("${rootProject.projectDir}/docker/${docker_dir}/Dockerfile")
files fileTree(rootProject.projectDir) {
include '.dockerignore'
include "docker/${docker_dir}/*"
include 'metadata-service/restli-servlet-impl/src/main/resources/index/**'
}.exclude {
i -> (!i.file.name.endsWith(".dockerignore") && i.file.isHidden())
}
tag("Debug", "${docker_registry}/${docker_repo}:debug")
// platform('linux/arm64', 'linux/amd64')
buildx(true)
load(true)
push(false)
// Add build args if they are defined (needed for some CI or enterprise environments)
def dockerBuildArgs = [:]
if (project.hasProperty('alpineApkRepositoryUrl')) {
dockerBuildArgs.ALPINE_REPO_URL = project.getProperty('alpineApkRepositoryUrl')
}
if (dockerBuildArgs.size() > 0) {
buildArgs(dockerBuildArgs)
}
}
tasks.getByName('docker').dependsOn('build')
task mkdirBuildDocker {
doFirst {
mkdir "${project.buildDir}/docker"
}
}
dockerClean.finalizedBy(mkdirBuildDocker)
task cleanLocalDockerImages {
doLast {
rootProject.ext.cleanLocalDockerImages(docker_registry, docker_repo, "${version}")
}
}
dockerClean.finalizedBy(cleanLocalDockerImages)