Add Docker build/push run config for arm64
This commit is contained in:
parent
cdaec894d8
commit
511e85ea79
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ __pycache__/
|
|||||||
!.idea/runConfigurations/
|
!.idea/runConfigurations/
|
||||||
.idea/runConfigurations/*
|
.idea/runConfigurations/*
|
||||||
!.idea/runConfigurations/Dev.xml
|
!.idea/runConfigurations/Dev.xml
|
||||||
|
!.idea/runConfigurations/Docker_Push.xml
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
# Frontend build
|
# Frontend build
|
||||||
|
|||||||
16
.idea/runConfigurations/Docker_Push.xml
generated
Normal file
16
.idea/runConfigurations/Docker_Push.xml
generated
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Docker Push" type="PythonConfigurationType" factoryName="Python">
|
||||||
|
<module name="llm_quota" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/build_push.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
50
build_push.py
Normal file
50
build_push.py
Normal file
@ -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()
|
||||||
Loading…
x
Reference in New Issue
Block a user