From a0512b3b2b948c42950313b5dc270faf6182d52c Mon Sep 17 00:00:00 2001 From: Oliver Hofmann Date: Wed, 29 Apr 2026 08:23:07 +0200 Subject: [PATCH] Replace build_push.py with build_push.sh, use shell script run config --- .idea/runConfigurations/Docker_Push.xml | 16 +++----- build_push.py | 50 ------------------------- build_push.sh | 30 +++++++++++++++ 3 files changed, 36 insertions(+), 60 deletions(-) delete mode 100644 build_push.py create mode 100755 build_push.sh diff --git a/.idea/runConfigurations/Docker_Push.xml b/.idea/runConfigurations/Docker_Push.xml index 4141036..a029020 100644 --- a/.idea/runConfigurations/Docker_Push.xml +++ b/.idea/runConfigurations/Docker_Push.xml @@ -1,16 +1,12 @@ - - + + \ No newline at end of file diff --git a/build_push.py b/build_push.py deleted file mode 100644 index a0d6eed..0000000 --- a/build_push.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/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() diff --git a/build_push.sh b/build_push.sh new file mode 100755 index 0000000..9e90983 --- /dev/null +++ b/build_push.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e +cd "$(dirname "$0")" + +IMAGE=mediaeng/llmproxy +PLATFORM=linux/arm64 + +VERSION=$(git describe --tags --always) +if [ -z "$VERSION" ]; then + echo "Fehler: git describe liefert kein Ergebnis" + exit 1 +fi + +echo "Version : $VERSION" +echo "Image : $IMAGE" +echo "Platform: $PLATFORM" +echo "Tags : $IMAGE:$VERSION $IMAGE:latest" +echo "" + +docker buildx build \ + --platform "$PLATFORM" \ + --push \ + -t "$IMAGE:$VERSION" \ + -t "$IMAGE:latest" \ + . + +echo "" +echo "Fertig. Gepusht:" +echo " docker pull $IMAGE:$VERSION" +echo " docker pull $IMAGE:latest"