Merge pull request 'feat: expose running CalVer version via API (#126)' (#127) from issue/126-feat-expose-running-calver-version-via-api into main

Reviewed-on: #127
This commit is contained in:
cal 2026-04-10 15:54:13 +00:00
commit 6972cbe610
3 changed files with 14 additions and 1 deletions

View File

@ -58,6 +58,8 @@ jobs:
tags: |
manticorum67/major-domo-database:${{ steps.version.outputs.version }}
manticorum67/major-domo-database:${{ steps.version.outputs.environment }}
build-args: |
BUILD_VERSION=${{ steps.version.outputs.version }}
cache-from: type=registry,ref=manticorum67/major-domo-database:buildcache
cache-to: type=registry,ref=manticorum67/major-domo-database:buildcache,mode=max

View File

@ -1,10 +1,16 @@
# Use official Python slim image
FROM python:3.12-slim
# Build-time version arg — passed by CI from the git tag
ARG BUILD_VERSION=dev
LABEL org.opencontainers.image.version=$BUILD_VERSION
# Set Python optimizations
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_NO_CACHE_DIR=1
# Bake the CalVer version into the image so it's readable at runtime
ENV APP_VERSION=$BUILD_VERSION
WORKDIR /usr/src/app
@ -26,7 +32,7 @@ RUN mkdir -p /usr/src/app/storage
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:80/api/v3/current || exit 1
CMD curl -f http://localhost:80/health || exit 1
# Start uvicorn
ENV WEB_WORKERS=2

View File

@ -139,6 +139,11 @@ app.include_router(views.router)
logger.info(f"Loaded all routers.")
@app.get("/health")
async def health():
return {"status": "ok", "version": os.environ.get("APP_VERSION", "dev")}
@app.get("/api/docs", include_in_schema=False)
async def get_docs(req: Request):
logger.debug(req.scope)