简体   繁体   English

如何使用 bmuschko/gradle-docker-plugin 在 springbootapplication 扩展中使用指令属性?

[英]How to use instruction property in springbootapplication extension with bmuschko/gradle-docker-plugin?

https://bmuschko.github.io/gradle-docker-plugin/ 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.我正在尝试使用上面的 gradle-docker-plugin 在 build.gradle 内使用 HEALTHCHECK 用于 spring-boot 应用程序,如下所示。

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.我指的是 plugin-user-guide at 2.5.2 of https://bmuschko.github.io/gradle-docker-plugin/current/user-guide/配置容器的健康检查。 But for springbootapplication extension, it throws an error saying "instruction" is an unknown property.但是对于 springbootapplication 扩展,它会抛出一个错误,说“instruction”是一个未知的属性。 Please help me resolve this.请帮我解决这个问题。 Thanks in advance.提前致谢。

The extension does not expose a property named instruction , as shown in the documentation .该扩展没有公开名为instruction的属性,如文档中所示。 You can modify the instructions of the task named createDockerfile though.不过,您可以修改名为createDockerfile的任务的说明。 The following adds the instruction to the existing list of instructions created by the plugin.下面将指令添加到插件创建的现有指令列表中。 See the Groovydocs of the task for more information.有关更多信息,请参阅任务的 Groovydocs

createDockerfile.instruction('HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:8080/actuator/health || exit 1')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有@SpringBootApplication时如何使用@JsonTest? - How to use @JsonTest when there is no @SpringBootApplication? 如何在没有spring boot gradle插件的情况下在gradle中使用spring boot - How to use spring boot in gradle without the spring boot gradle plugin 如何外部化@SpringBootApplication 配置? - How to externalize @SpringBootApplication configuration? 如何在 Gradle 项目中使用 Mybatis Pagehelper 插件? - How to use Mybatis Pagehelper plugin in Gradle Project? 在 Docker build 上下载 gradle 插件,并在 Docker 运行期间使用 without.network - Download gradle plugin on Docker build and use without network during Docker run 如何使用@SpringBootApplication和@Configuration,数据源 - How to work with @SpringBootApplication and @Configuration, Datasource 在Maven项目中使用gradle-ospackage-plugin - Use gradle-ospackage-plugin in a maven project 使用 Spring 引导 Gradle 插件和 Colima 构建 Docker 映像 - Building a Docker Image with the Spring Boot Gradle Plugin and Colima Docker Compose - Wiremock 无法回答来自 SpringBootApplication 的 REST 调用 - Docker Compose - Wiremock not able to answer REST call from SpringBootApplication 如何从@WebMvcTest中排除@SpringBootApplication中有线的服务 - How to exclude services wired in @SpringBootApplication from @WebMvcTest
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM