Speed up container image building (pull + build)

Avoids downloading the container image 4 times in the multi-stage build
by first pulling the alpine image once and then building without any
pulls.

Implemented following a suggestion of @apyrgio.
This commit is contained in:
deeplow 2024-01-08 10:16:55 +00:00
parent 550786adfe
commit 0a54f6461a
No known key found for this signature in database
GPG key ID: 577982871529A52A

View file

@ -33,12 +33,21 @@ def main():
print("Exporting container pip dependencies")
export_container_pip_dependencies()
print("Pulling base image")
subprocess.run(
[
args.runtime,
"pull",
"alpine:latest",
],
check=True,
)
print("Building container image")
subprocess.run(
[
args.runtime,
"build",
"--pull",
BUILD_CONTEXT,
"--build-arg",
f"REQUIREMENTS_TXT={REQUIREMENTS_TXT}",