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