infra: make it possible to cache docker containers build (#12284)

Signed-off-by: David Korczynski <david@adalogics.com>
This commit is contained in:
DavidKorczynski 2024-08-02 09:10:35 +01:00 committed by GitHub
parent e409cd2da0
commit 3beb664440
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -721,9 +721,14 @@ def docker_run(run_args, print_output=True, architecture='x86_64'):
"""Calls `docker run`."""
platform = 'linux/arm64' if architecture == 'aarch64' else 'linux/amd64'
command = [
'docker', 'run', '--rm', '--privileged', '--shm-size=2g', '--platform',
platform
'docker', 'run', '--privileged', '--shm-size=2g', '--platform', platform
]
if os.getenv('OSS_FUZZ_SAVE_CONTAINERS_NAME'):
command.append('--name')
command.append(os.getenv('OSS_FUZZ_SAVE_CONTAINERS_NAME'))
else:
command.append('--rm')
# Support environments with a TTY.
if sys.stdin.isatty():
command.append('-i')