Files
DroidDeck/tools/docker_preflight.py
T
Kurt Himebauch 0516d023fa feat: art-first library cards with a display menu (#1744)
* feat: art-first library cards with a display menu for size, title and storage

* build: use native arm64 docker on Apple Silicon and add a fast deploy loop

* fix: address review feedback on library cards and local build scripts
2026-10-28 22:40:53 -04:00

26 lines
1.1 KiB
Python

"""Check the engine before modifying build assets; never rebuild for a daemon error."""
import os
from pathlib import Path
import subprocess
import sys
def run(*args):
try:
return subprocess.run(['docker', *args], capture_output=True, text=True, timeout=15)
except subprocess.TimeoutExpired:
sys.exit('Docker is not responding. Restart Docker Desktop, then rerun tools/build_local.sh.')
if __name__ == '__main__':
engine = run('info', '--format', '{{.ServerVersion}}')
if engine.returncode:
sys.exit('Docker is unavailable: ' + engine.stderr.strip())
image = run('image', 'inspect', sys.argv[1])
if image.returncode:
if 'No such image' not in image.stderr and 'image not known' not in image.stderr: # Docker, Podman
sys.exit('Cannot inspect the build image: ' + image.stderr.strip())
repo = Path(__file__).resolve().parents[1]
subprocess.run(['docker', 'build', '--platform', os.environ.get('DROIDDECK_DOCKER_PLATFORM', 'linux/amd64'), '-t', sys.argv[1],
'-f', str(repo / 'tools/local-cross.Dockerfile'), str(repo)], check=True)