You need to sign in or sign up before continuing.
Newer
Older
#!/usr/bin/env python3
"""
Build all Dockerfiles and check the build result
"""
import sys
from asyncio.subprocess import DEVNULL, PIPE
DISTRIBUTIONS = (
"16.04 18.04 20.04 fedora28 fedora31 archlinux stretch buster centos7".split()
)
async def build_run(dist, verbose=False, parallel=1):
cmd = f"docker build --build-arg DIST={dist} --build-arg PARALLEL={parallel} -t all/{dist} ."
print(f"+ {cmd}\r")
proc = await asyncio.create_subprocess_exec(
*cmd.split(), stdout=DEVNULL, stderr=DEVNULL
)
print(f"+ {cmd}\r")
proc = await asyncio.create_subprocess_exec(
*cmd.split(), stdout=PIPE, stderr=DEVNULL
)
if len(sys.argv) > 1:
loop.run_until_complete(build_run(sys.argv[1], verbose=True, parallel=8))
else:
loop.run_until_complete(
asyncio.gather(*(build_run(dist) for dist in DISTRIBUTIONS))
)