add version and fix autocomplete
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 3m59s

This commit is contained in:
Karl 2025-07-09 10:59:28 +01:00
parent ba63f64e98
commit deeea48b20
4 changed files with 20 additions and 6 deletions

View File

@ -23,8 +23,6 @@ jobs:
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@ -43,3 +41,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ steps.meta.outputs.version }}

11
app.py
View File

@ -31,6 +31,17 @@ app.config['SESSION_COOKIE_SAMESITE'] = 'Lax' # Adjust for cross-site requests
app.config['PERMANENT_SESSION_LIFETIME'] = 60 * 60 * 24 * 365 # 1 year in seconds
cache.clear() # Clears all cache entries
def get_version():
try:
with open('VERSION', 'r') as f:
return f.read().strip()
except FileNotFoundError:
return 'dev'
@app.context_processor
def inject_version():
return dict(version=get_version())
@app.before_request
def make_session_permanent():
session.permanent = True

View File

@ -1,13 +1,13 @@
FROM python:3.11-slim
FROM python:3.11-slim-bookworm
# Install system dependencies required by PaddleOCR and OpenCV
RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
libgomp1 \
libgl1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
@ -17,6 +17,9 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ARG VERSION
RUN echo $VERSION > VERSION
EXPOSE 8089
CMD ["python", "app.py"]

View File

@ -83,7 +83,7 @@
<!-- Footer -->
<footer class="bg-dark text-white text-center py-3 mt-5">
<p></p>
<p>Version: {{ version }}</p>
</footer>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>