Skip to content

Commit

Permalink
Always bust builder cache building the container image
Browse files Browse the repository at this point in the history
Do not use by default the builder cache, when we build the Dangerzone
container image. This way, we can always have the most fresh result when
we run the `./install/common/build-image.py` command.

If a dev wants to speed up non-release builds, we add the `--use-cache`
flag to use the builder cache.
  • Loading branch information
apyrgio committed Sep 10, 2024
1 parent 2237f76 commit 7d6236a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions install/common/build-image.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,36 @@ def main():
default=9,
help="The Gzip compression level, from 0 (lowest) to 9 (highest, default)",
)
parser.add_argument(
"--use-cache",
action="store_true",
help="Use the builder's cache to speed up the builds (not suitable for release builds)",
)
args = parser.parse_args()

print(f"Building for architecture '{ARCH}'")

print("Exporting container pip dependencies")
with ContainerPipDependencies():
print("Pulling base image")
subprocess.run(
[
args.runtime,
"pull",
"alpine:latest",
],
check=True,
)
if not args.use_cache:
print("Pulling base image")
subprocess.run(
[
args.runtime,
"pull",
"alpine:latest",
],
check=True,
)

print("Building container image")
cache_args = [] if args.use_cache else ["--no-cache"]
subprocess.run(
[
args.runtime,
"build",
BUILD_CONTEXT,
*cache_args,
"--build-arg",
f"REQUIREMENTS_TXT={REQUIREMENTS_TXT}",
"--build-arg",
Expand Down

0 comments on commit 7d6236a

Please sign in to comment.