Compare commits

...

2 Commits

Author SHA1 Message Date
Quentin Guilloteau
db4e4f3baf system g5k by default 2024-09-11 10:51:59 +02:00
Quentin Guilloteau
a4d9ede97d add support for --build-arg flag 2024-09-11 10:51:38 +02:00
4 changed files with 17 additions and 7 deletions

View File

@ -6,10 +6,14 @@
conf_date = 2024,
comment = "There are two dockerfiles. a dockerfile from the authors that serves as a base image. we will only rebuild the base image. the top level image appear to be mostly a copy + compile, no install",
virtualization = "docker",
buildfile_dir = ".",
dockerfile_path = ".docker/base/dockerfile",
buildfile_dir = "xpn-docker-euro-par2024",
dockerfile_path = "docker/base/dockerfile",
build_args = [
"UID=1234",
"GID=1000"
],
package_managers = [ "dpkg" ],
misc_packages = [
{ name = "mpich-4.1.1", url = "https://www.mpich.org/static/downloads/4.1.1/mpich-4.1.1.tar.gz" }
]
}
}

View File

@ -1,7 +1,7 @@
folder_artifacts_nickel: "artifacts/nickel"
folder_artifacts_json: "artifacts/json"
folder_blacklists: "blacklists"
system: "local"
system: "g5k"
prefix: "outputs"
analysis_dir: "outputs/analysis"
plot_dir: "outputs/analysis/plot"

View File

@ -74,9 +74,10 @@ def buildresult_saver(result, buildstatus_path, config_path):
timestamp = str(datetime.datetime.timestamp(now))
buildstatus_file.write(f"{artifact_name},{timestamp},{result}\n")
def build_image(path, dockerfile_path, image_name):
def build_image(path, dockerfile_path, image_name, build_args):
logging.info(f"Starting building image {image_name}")
build_command = f"docker build --no-cache -t {image_name} -f {dockerfile_path} ."
build_args_str = " ".join(map(lambda x: f"--build-arg {x}", build_args))
build_command = f"docker build --no-cache -t {image_name} {build_args_str} -f {dockerfile_path} ."
build_process = subprocess.run(build_command.split(" "), cwd=path, capture_output=True)
build_output = f"stdout:\n{build_process.stdout.decode('utf-8')}\nstderr:\n{build_process.stderr.decode('utf-8')}"
logging.info(f"Output of '{build_command}':\n\n{build_output}")
@ -253,7 +254,7 @@ def ecg(artifact_name, config_path, pkglist_path, buildstatus_path, arthashlog_p
if artifact_dir != "":
path = os.path.join(artifact_dir, config["buildfile_dir"])
return_code, build_output = build_image(path, config["dockerfile_path"], artifact_name)
return_code, build_output = build_image(path, config["dockerfile_path"], artifact_name, config["build_args"])
if return_code == 0:
status = "success"
check_env(config, artifact_dir, artifact_name, pkglist_path)

View File

@ -82,6 +82,11 @@ in
| doc "Path to the Dockerfile from the build directory"
| FilePath
| default = "Dockerfile",
build_args
| doc "Build arguments for Docker ('--build-arg')"
| optional
| Array String
| default = [],
package_managers
| doc "Package Managers used in the container. Possible values: dpkg, rpm, pacman, pip, conda"
| optional