Code: Select all
#!/usr/bin/env groovy
@Grapes(
[
@Grab(group='de.gesellix', module='docker-client', version='2025-01-19T00-00-00'),
@Grab(group='commons-io', module='commons-io', version='2.18.0'),
]
)
import de.gesellix.docker.remote.api.BuildInfo
import de.gesellix.docker.remote.api.core.StreamCallback
import org.apache.commons.io.IOUtils
import de.gesellix.docker.client.DockerClientImpl
import java.nio.charset.StandardCharsets
void buildTestContainer() {
def dockerBuildStr = """FROM ubuntu:25.04\n
RUN env DEBIAN_FRONTEND=noninteractive apt update && apt install -y curl python3-pyqt6 libmpv-dev python3-pycodestyle xvfb
RUN curl -LsSf https://astral.sh/uv/install.sh | env XDG_BIN_HOME=/bin sh
""".stripIndent()
def buildFileStream = IOUtils.toInputStream(dockerBuildStr, StandardCharsets.UTF_8);
dockerClient = new DockerClientImpl()
println(dockerClient.images())
println(dockerClient.ping().content)
dockerClient.build(new StreamCallback() {
@Override
void onNext(BuildInfo buildInfo) {
println(buildInfo)
}
},
java.time.Duration.ofDays(1),
buildFileStream
)
}
buildTestContainer()
< /code>
Dies führt zu < /p>
...(a bunch of image names, omitted)...
OK
Caught: {"message":"unexpected EOF"}
{"message":"unexpected EOF"}
at de.gesellix.docker.remote.api.client.ImageApi.imageBuild(ImageApi.kt:277)
at de.gesellix.docker.remote.api.client.ImageApi$imageBuild$0.call(Unknown Source)