Spaces:
Sleeping
Sleeping
Auto-set version from git commit hash on each deploy
Browse files- Dockerfile writes short commit hash to VERSION file at build time
- /api/version endpoint reads VERSION file
- Frontend fetches and displays version below navigation
- Version updates automatically with every push/deploy
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files changed (4)
- .gitignore+1
- Dockerfile+4-1
- frontend/index.html+6-1
- src/api.py+11
31 unmodified lines32333431 unmodified lines.vscode/.idea/*.swp31 unmodified lines3233343531 unmodified lines.vscode/.idea/*.swpVERSION
3 unmodified lines456789103 unmodified lines1415161718193 unmodified lines# System-DependenciesRUN apt-get update && apt-get install -y --no-install-recommends \build-essential \&& rm -rf /var/lib/apt/lists/*# Python-Dependencies3 unmodified lines# App-Code kopierenCOPY . .# PYTHONPATH setzenENV PYTHONPATH=/app3 unmodified lines456789103 unmodified lines1415161718192021223 unmodified lines# System-DependenciesRUN apt-get update && apt-get install -y --no-install-recommends \build-essential git \&& rm -rf /var/lib/apt/lists/*# Python-Dependencies3 unmodified lines# App-Code kopierenCOPY . .# Speichere Git-Commit-Hash als Version (falls .git vorhanden)RUN if [ -d .git ]; then git rev-parse --short HEAD > VERSION; else echo "dev" > VERSION; fi# PYTHONPATH setzenENV PYTHONPATH=/app
724 unmodified lines725726727728729730731121 unmodified lines853854855856857858724 unmodified lines<button class="active" id="btnModeChat" onclick="switchMode('chat')">Chat</button><button id="btnModeVoice" onclick="switchMode('voice')">Voice Guide</button></div><div class="app-version">v0.2.0</div></header><main>121 unmodified linesconst API_BASE = window.location.hostname.includes('github.io')? 'https://FC-Bit-arkanum.hf.space': window.location.origin;let selectedImage = null;let selectedImageType = 'image/jpeg';724 unmodified lines725726727728729730731121 unmodified lines853854855856857858859860861862863724 unmodified lines<button class="active" id="btnModeChat" onclick="switchMode('chat')">Chat</button><button id="btnModeVoice" onclick="switchMode('voice')">Voice Guide</button></div><div class="app-version" id="appVersion">v0.2.0</div></header><main>121 unmodified linesconst API_BASE = window.location.hostname.includes('github.io')? 'https://FC-Bit-arkanum.hf.space': window.location.origin;// Load version from serverfetch(`${API_BASE}/api/version`).then(r => r.json()).then(d => {document.getElementById('appVersion').textContent = d.version;}).catch(() => {});let selectedImage = null;let selectedImageType = 'image/jpeg';
160 unmodified lines161162163164165166160 unmodified linesreturn {"status": "ok"}# --- Walkthrough & Voice Guide ---160 unmodified lines161162163164165166167168169170171172173174175176177160 unmodified linesreturn {"status": "ok"}@app.get("/api/version")async def version():"""Git-Commit-Hash als Version (aus VERSION-Datei, beim Docker-Build erzeugt)."""version_file = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "VERSION")try:with open(version_file) as f:return {"version": f.read().strip()}except FileNotFoundError:return {"version": "dev"}# --- Walkthrough & Voice Guide ---
.gitignore+1
Dockerfile+4-1
frontend/index.html+6-1
src/api.py+11