gpt4 book ai didi

docker - Gradle docker build 无限期挂起

转载 作者:行者123 更新时间:2023-12-04 11:45:43 31 4
gpt4 key购买 nike

即使使用完全相同的参数运行,我的构建也会随机运行并随机挂起。我的复制任务后总是卡住(某些部分替换为 )

task createDocker(group: '<placeholder>', type: Docker) {
push = true
dockerfile = file(stageDir.getAbsolutePath()+"/Dockerfile")
project.group = "<placeholder>"
applicationName = "<placeholder>-clusterservice"
tagVersion = "${project.version}"

doFirst {
println ("Copying Dockerfile to staging area:" + stageDir.getAbsolutePath())
copy {
from "${project.projectDir}/src/main/docker/"
include "**/*"
into stageDir
}

println ("Getting artifact")
copy {
from "$distDir/${war.baseName}-${war.version}.war"
rename "${war.baseName}-${war.version}.war", "clusterservice.war"
into stageDir
}
}
}

我用调试标志运行它,这是它工作时的样子:
[16:26:15] :     [Step 1/1] 16:25:49.730 [QUIET] [system.out] Getting artifact
[16:26:15] : [Step 1/1] 16:25:50.041 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute doFirst {} action for :clusterservice:createDocker'
[16:26:15] : [Step 1/1] 16:25:50.041 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute doFirst {} action for :clusterservice:createDocker' completed
[16:26:15] : [Step 1/1] 16:25:50.041 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute build for :clusterservice:createDocker' started
[16:26:15] : [Step 1/1] 16:25:50.041 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Setting up staging directory.
[16:26:15] : [Step 1/1] 16:25:50.041 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Creating Dockerfile from file /opt/teamcity/agent/work/7fe8da50bfc4c49f/clusterservice/build-gradle/docker/Dockerfile.
[16:26:15] : [Step 1/1] 16:25:50.045 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Determining image tag: <placeholder>/<placeholder>-clusterservice:8.23.0-SNAPSHOT
[16:26:15] : [Step 1/1] 16:25:50.045 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Using the native docker binary.
[16:26:15] : [Step 1/1] 16:26:05.213 [QUIET] [system.out] Sending build context to Docker daemon 194MB
[16:26:15] : [Step 1/1] 16:26:05.213 [QUIET] [system.out] Step 1/33 : FROM <placeholder>/tomcat-openjre8:8.5.40
[16:26:15] : [Step 1/1] 16:26:05.213 [QUIET] [system.out] ---> aa259d3bf785
[16:26:15] : [Step 1/1] 16:26:05.213 [QUIET] [system.out] Step 2/33 : LABEL MAINTAINER 'dev@<placeholder>.com'
[16:26:15] : [Step 1/1] 16:26:05.213 [QUIET] [system.out] ---> Using cache
[16:26:15] : [Step 1/1] 16:26:05.213 [QUIET] [system.out] ---> 14bff4363c7f
...

然后它继续正常构建,没有错误!

这是在完全相同的机器和完全相同的参数上运行的失败构建
[15:53:03] :     [Step 1/1] 15:52:37.030 [QUIET] [system.out] Getting artifact
[15:53:03] : [Step 1/1] 15:52:38.608 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute doFirst {} action for :clusterservice:createDocker'
[15:53:03] : [Step 1/1] 15:52:38.609 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute doFirst {} action for :clusterservice:createDocker' completed
[15:53:03] : [Step 1/1] 15:52:38.609 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute build for :clusterservice:createDocker' started
[15:53:03] : [Step 1/1] 15:52:38.609 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Setting up staging directory.
[15:53:03] : [Step 1/1] 15:52:38.612 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Creating Dockerfile from file /opt/teamcity/agent/work/7fe8da50bfc4c49f/clusterservice/build-gradle/docker/Dockerfile.
[15:53:03] : [Step 1/1] 15:52:38.645 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Determining image tag: <placeholder>/<placeholder>-clusterservice:8.23.0-SNAPSHOT
[15:53:03] : [Step 1/1] 15:52:38.645 [INFO] [se.transmode.gradle.plugins.docker.DockerTask] Using the native docker binary.
[15:53:03] : [Step 1/1] 15:53:03.859 [LIFECYCLE] [org.gradle.process.internal.health.memory.MemoryManager]
[15:53:03] : [Step 1/1] 15:53:03.859 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 33737138176, Free: 26021330944}
[15:53:03] : [Step 1/1] 15:53:03.859 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 33737138176, Free: 26021330944}
[15:53:03] : [Step 1/1] 15:53:03.859 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 1908932608, Committed: 1186463744}
[15:53:08] : [Step 1/1] 15:53:08.859 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 33737138176, Free: 26022682624}
[15:53:08] : [Step 1/1] 15:53:08.859 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 33737138176, Free: 26022682624}
[15:53:08] : [Step 1/1] 15:53:08.859 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 1908932608, Committed: 1186463744}
[15:53:11] : [Step 1/1] 15:53:11.450 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
[15:53:11] : [Step 1/1] 15:53:11.450 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
[15:53:11] : [Step 1/1] 15:53:11.450 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
...

它不会出错,并且运行状况检查会重复并无限期运行(我让它运行了 2 个小时以上),并且它只是继续挂起而没有任何错误。我不知道它有什么问题,如果我手动运行命令,构建运行完全正常。如果它有效,构建大约需要 7 分钟左右。请帮忙。

最佳答案

看来这个特定 docker gradle 插件的项目开发已被放弃。
如果您在此处查看此 github 页面上的问题 https://github.com/Transmode/gradle-docker/issues/119和这里 https://github.com/Transmode/gradle-docker/issues/37你会看到这个问题是多年前报告的,但从未合并过任何修复程序。
还有其他可用的 gradle docker 插件在开发中更加活跃,您可以使用它们。这个https://github.com/bmuschko/gradle-docker-plugin想到。
就我个人而言,在对所有这些感到非常厌烦之后,我只是在 bash 脚本中重写了所有内容,并使用 gradle 调用所述脚本以进行我必要的 docker 配置。

关于docker - Gradle docker build 无限期挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58175267/

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