Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29445

docker image of spring boot application

$
0
0

I want to learn how to create docker image of spring boot application with Gradle as their is requirement for same in my shop.

To get started i have referred https://spring.io/guides/gs/spring-boot-docker/

I followed all steps as mentioned here.

My Dockerfile look like below

FROM openjdk:8-jdk-alpine
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
EXPOSE 8080
ENTRYPOINT ["java","-cp","app:app/lib/*","hello.Application"]

and my build.gradle is

buildscript {
    repositories {
        mavenCentral()
     }
     dependencies {
         classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
           }
      }

group = 'springio'
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'

bootJar {
    baseName = 'gs-spring-boot-docker'
   version =  '0.1.0'
      } 

repositories {
   mavenCentral()
    }

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
      compile("org.springframework.boot:spring-boot-starter-web") 
     testCompile("org.springframework.boot:spring-boot-starter-test")
 }

task unpack(type: Copy) {
    dependsOn bootJar
    from(zipTree(tasks.bootJar.outputs.files.singleFile))
   into("build/dependency")
     }
docker {
    name "${project.group}/${bootJar.baseName}"
    copySpec.from(tasks.unpack.outputs).into("dependency")
    buildArgs(['DEPENDENCY': "dependency"])
 }

But when i am ruining

    $./gradlew build docker

Getting below error

    FAILURE: Build failed with an exception.

    * Where:
       Build file '/root/springboot-Dockerf/gs-spring-boot-docker/initial/build.gradle' line: 16

    * What went wrong:
        A problem occurred evaluating root project 'initial'.
    > Plugin with id 'com.palantir.docker' not found.

    * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get 
      more log output. Run with --scan to get full insights.

Viewing all articles
Browse latest Browse all 29445

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>