0

https://bmuschko.github.io/gradle-docker-plugin/

I am trying to use HEALTHCHECK inside build.gradle using the above gradle-docker-plugin for a spring-boot app as following.

docker {
  springBootApplication {
    baseImage = 'docker.infy.com:4443/containers/openjdk-11jre:latest'
    maintainer = "astra-aws-dev@infy.com, ic-pe@infy.com"
    ports = [8080]
    images = ["infy/${project.name}:latest"]
    jvmArgs = ['-server', '-Dathenz.zpe.policy_dir=/var/zpe', 'Dathenz.athenz_conf=/etc/athenz/athenz.conf']
    instruction = 'HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/actuator/health || exit 1'
  }
}

I am referring to the plugin-user-guide at 2.5.2 of https://bmuschko.github.io/gradle-docker-plugin/current/user-guide/ to configure the healthcheck of the container. But for springbootapplication extension, it throws an error saying "instruction" is an unknown property. Please help me resolve this. Thanks in advance.

ABHISHEK KUMAR
  • 71
  • 1
  • 10

1 Answers1

1

The extension does not expose a property named instruction, as shown in the documentation. You can modify the instructions of the task named createDockerfile though. The following adds the instruction to the existing list of instructions created by the plugin. See the Groovydocs of the task for more information.

createDockerfile.instruction('HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/actuator/health || exit 1')
Benjamin Muschko
  • 32,442
  • 9
  • 61
  • 82