diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..53c2635 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM alpine + +RUN apk update && \ + apk upgrade +RUN apk add openjdk8 + +VOLUME /tmp +ARG DEPENDENCY=target/dependency + +COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib +COPY ${DEPENDENCY}/META-INF /app/META-INF +COPY ${DEPENDENCY}/BOOT-INF/classes /app + +CMD java -cp /app:app/lib/* org.kpmp.eridanus.Application \ No newline at end of file diff --git a/build.gradle b/build.gradle index daf05af..11a442a 100644 --- a/build.gradle +++ b/build.gradle @@ -7,11 +7,19 @@ buildscript { } } +plugins { + id 'com.palantir.docker' version '0.22.1' +} + +group = 'kingstonduo' +version = "latest" + apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' +apply plugin: 'com.palantir.docker' eclipse { project.natures 'org.eclipse.buildship.core.gradleprojectnature' @@ -48,3 +56,15 @@ dependencies { springBoot { mainClass = "org.kpmp.eridanus.Application" } + +task unpack(type: Copy) { + dependsOn bootJar + from(zipTree(tasks.bootJar.outputs.files.singleFile)) + into("build/dependency") +} + +docker { + name "${project.group}/${jar.baseName}:${project.version}" + copySpec.from(tasks.unpack.outputs).into("dependency") + buildArgs(['DEPENDENCY': "dependency"]) +} \ No newline at end of file