From 511e85ea797ab1835175c9800393bbe646b207eb Mon Sep 17 00:00:00 2001 From: Oliver Hofmann Date: Wed, 29 Apr 2026 08:20:15 +0200 Subject: [PATCH] Add Docker build/push run config for arm64 --- .gitignore | 1 + .idea/runConfigurations/Docker_Push.xml | 16 ++++++++ build_push.py | 50 +++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 .idea/runConfigurations/Docker_Push.xml create mode 100644 build_push.py diff --git a/.gitignore b/.gitignore index 5300ec1..9aff2f5 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ __pycache__/ !.idea/runConfigurations/ .idea/runConfigurations/* !.idea/runConfigurations/Dev.xml +!.idea/runConfigurations/Docker_Push.xml .vscode/ # Frontend build diff --git a/.idea/runConfigurations/Docker_Push.xml b/.idea/runConfigurations/Docker_Push.xml new file mode 100644 index 0000000..4141036 --- /dev/null +++ b/.idea/runConfigurations/Docker_Push.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/build_push.py b/build_push.py new file mode 100644 index 0000000..a0d6eed --- /dev/null +++ b/build_push.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +"""Baut das Docker-Image für arm64 und pushed es zu DockerHub.""" +import subprocess +import sys +from pathlib import Path + +IMAGE = 'mediaeng/llmproxy' +PLATFORM = 'linux/arm64' + + +def run(cmd: list[str], cwd: Path): + print(f'$ {" ".join(cmd)}\n') + result = subprocess.run(cmd, cwd=cwd) + if result.returncode != 0: + sys.exit(result.returncode) + + +def main(): + root = Path(__file__).parent + + version = subprocess.run( + ['git', 'describe', '--tags', '--always'], + cwd=root, capture_output=True, text=True, + ).stdout.strip() + + if not version: + print('Fehler: git describe liefert kein Ergebnis') + sys.exit(1) + + print(f'Version : {version}') + print(f'Image : {IMAGE}') + print(f'Platform: {PLATFORM}') + print(f'Tags : {IMAGE}:{version} {IMAGE}:latest\n') + + run([ + 'docker', 'buildx', 'build', + '--platform', PLATFORM, + '--push', + '-t', f'{IMAGE}:{version}', + '-t', f'{IMAGE}:latest', + '.', + ], cwd=root) + + print(f'\nFertig. Gepusht:') + print(f' docker pull {IMAGE}:{version}') + print(f' docker pull {IMAGE}:latest') + + +if __name__ == '__main__': + main()