Less verbose, no docker commands
This commit is contained in:
parent
a8a32e91b9
commit
099436306b
12
build.py
12
build.py
@ -134,7 +134,7 @@ def download_file(file: DownloadInfo, filename: Path):
|
||||
return filename
|
||||
|
||||
|
||||
def docker_buildx(repository: str, tags: list[str], build_platforms: list[DockerPlatforms], dockerfile: str = "Dockerfile", build_args: DockerfileBuildArgs | dict[str, Any] | None = None, directory: str = "."):
|
||||
def docker_buildx(repository: str, tags: list[str], build_platforms: list[DockerPlatforms], dockerfile: str = "Dockerfile", build_args: DockerfileBuildArgs | dict[str, Any] | None = None, directory: str = ".", write_command: bool = False):
|
||||
if build_args is None:
|
||||
build_args = dict()
|
||||
labels = [f"{repository}:{tag}"for tag in tags]
|
||||
@ -145,8 +145,10 @@ def docker_buildx(repository: str, tags: list[str], build_platforms: list[Docker
|
||||
"--file", dockerfile,
|
||||
*[t for label in labels for t in ("--tag", label)],
|
||||
"--pull", "--push", directory]
|
||||
print(" ".join(command))
|
||||
process = subprocess.run(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
if write_command:
|
||||
print(" ".join(command))
|
||||
process = subprocess.run(
|
||||
command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
if process.returncode != 0:
|
||||
output = process.stdout.decode('utf-8')
|
||||
print(output)
|
||||
@ -190,7 +192,7 @@ def build_version(manifest: VersionManifest, version_id: str, repository: str =
|
||||
print(
|
||||
f"Building version {version['id']} (Java {java_version['majorVersion']})")
|
||||
|
||||
# Build GraalVM images
|
||||
print("# Build GraalVM images")
|
||||
if java_version['majorVersion'] == 17:
|
||||
graal_platforms: list[DockerPlatforms] = ["linux/arm64", "linux/amd64"]
|
||||
build_args["DOCKER_IMAGE"] = f"ghcr.io/graalvm/jdk:java{java_version['majorVersion']}"
|
||||
@ -200,7 +202,7 @@ def build_version(manifest: VersionManifest, version_id: str, repository: str =
|
||||
print(
|
||||
f"No GraalVM image can be built for {version['id']} (Java {java_version['majorVersion']})")
|
||||
|
||||
# Build Temurin
|
||||
print("# Build Temurin images")
|
||||
build_args["DOCKER_IMAGE"] = f"eclipse-temurin:{java_version['majorVersion']}-jre"
|
||||
temurin_platforms: list[DockerPlatforms] = [
|
||||
"linux/arm64", "linux/arm/v7", "linux/amd64", "linux/ppc64le"]
|
||||
|
Loading…
Reference in New Issue
Block a user