Com.palantir.docker: Difference between revisions
Jump to navigation
Jump to search
Line 47: | Line 47: | ||
dependsOn build | dependsOn build | ||
// bootJar.baseName resolves to the artifact name, without version and extension information | // bootJar.baseName resolves to the artifact name, without version and extension information | ||
name "com.example/playground/${bootJar.baseName}" | name "com.example/playground/${bootJar.baseName}" | ||
dockerfile file('Dockerfile') | dockerfile file('Dockerfile') | ||
// bootJar.archivePath resolves to the absolute path of the artifact file | // bootJar.archivePath resolves to the absolute path of the artifact file | ||
files bootJar.archivePath | files bootJar.archivePath | ||
// bootJar.archiveName resolves to the artifact name, including version and extension | // bootJar.archiveName resolves to the artifact name, including version and extension | ||
buildArgs(['JAR_FILE': "${bootJar.archiveName}"]) | buildArgs(['JAR_FILE': "${bootJar.archiveName}"]) |
Revision as of 08:47, 6 February 2019
External
Internal
Overview
Latest Version
Example
buildscript {
ext {
...
dockerGradleVersion = '0.21.0'
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
...
classpath("gradle.plugin.com.palantir.gradle.docker:gradle-docker:${dockerGradleVersion}")
}
}
...
apply plugin: 'com.palantir.docker'
...
docker {
dependsOn build
// bootJar.baseName resolves to the artifact name, without version and extension information
name "com.example/playground/${bootJar.baseName}"
dockerfile file('Dockerfile')
// bootJar.archivePath resolves to the absolute path of the artifact file
files bootJar.archivePath
// bootJar.archiveName resolves to the artifact name, including version and extension
buildArgs(['JAR_FILE': "${bootJar.archiveName}"])
}
The corresponding Dockerfile:
FROM openjdk:8-jdk-alpine
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
RUN apk --no-cache add curl bash bind-tools
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]