gpt4 book ai didi

docker - 覆盖bmuschko Gradle Docker插件生成的整个默认Dockerfile

转载 作者:行者123 更新时间:2023-12-03 05:28:25 25 4
gpt4 key购买 nike

我正在尝试覆盖Gradle脚本中由bmuschko生成的整个Dockerfile。但是,我似乎可以做的只是将其添加到其底部。我有一个要使用的自定义Dockerfile,但是使用插件(com.bmuschko.docker-spring-boot-application:6.1.2)会覆盖它。我尝试添加新的入口点,指令和structionsFromTemplate,但是所有这些操作都是将它们附加到生成文件的底部:

https://bmuschko.github.io/gradle-docker-plugin/api/com/bmuschko/gradle/docker/tasks/image/Dockerfile.html

tasks.withType<Dockerfile> {
instructionsFromTemplate("src/main/resources/Dockerfile")
entryPoint("top", "-b")
instruction("FROM azul/zulu-openjdk-centos:latest")
}

也尝试过:
tasks.withType<DockerBuildImage> {
dockerFile.set(File("src/main/resources/Dockerfile"))
}
gw dockerBuildImage说它实际上正在使用我的Dockerfile,但随后引发错误:
Using Dockerfile '/Users/meanwhileinhell/my-app/src/main/resources/Dockerfile'
Using images 'com.meanwhileinhell.app/meanwhileinhell-server:1.0.0-snapshot'.

Error during callback
com.github.dockerjava.api.exception.InternalServerErrorException: Cannot locate specified Dockerfile: /Users/meanwhileinhell/my-app/src/main/resources/Dockerfile
at com.github.dockerjava.jaxrs.filter.ResponseStatusExceptionFilter.filter(ResponseStatusExceptionFilter.java:59)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:133)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.client.ClientFilteringStages$ResponseFilterStage.apply(ClientFilteringStages.java:121)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.process.internal.Stages.process(Stages.java:171)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:283)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:767)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:229)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:414)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:765)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:456)
at com.bmuschko.gradle.docker.shaded.org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:357)
at com.github.dockerjava.jaxrs.async.POSTCallbackNotifier.response(POSTCallbackNotifier.java:29)
at com.github.dockerjava.jaxrs.async.AbstractCallbackNotifier.call(AbstractCallbackNotifier.java:50)
at com.github.dockerjava.jaxrs.async.AbstractCallbackNotifier.call(AbstractCallbackNotifier.java:24)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

它说找不到的 Dockerfile恰好在它说找不到的位置。

如何完全覆盖此文件?

最佳答案

尝试使用

tasks.withType<DockerBuildImage> {
inputDir.set(file("src/main/resources/"))
}

关于docker - 覆盖bmuschko Gradle Docker插件生成的整个默认Dockerfile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60372983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com