- New Import page: upload an export (with upload progress) or, when the server has a Last.fm API key, import straight from a Last.fm username; jobs list with live progress, counts, errors and cancelling - docker compose runs the import worker from the API image; the API image no longer sets PROMETHEUS_MULTIPROC_DIR (gunicorn.conf.py does, and other commands must not inherit multiprocess mode) - Prometheus scrapes the worker; Usage dashboard gains an Imports row; ImportWorkerDown and ImportJobsWaiting alerts - README and .env.example document imports and LASTFM_API_KEY Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
31 lines
1.2 KiB
Docker
31 lines
1.2 KiB
Docker
# Scrobbler API: gunicorn serving the Flask app, metrics on :9100.
|
|
FROM ghcr.io/astral-sh/uv:0.7.21 AS uv
|
|
|
|
FROM python:3.13-slim AS build
|
|
COPY --from=uv /uv /usr/local/bin/uv
|
|
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=never
|
|
WORKDIR /app
|
|
COPY pyproject.toml uv.lock README.md ./
|
|
RUN uv sync --locked --no-dev --no-install-project
|
|
COPY src ./src
|
|
RUN uv sync --locked --no-dev --no-editable
|
|
|
|
FROM python:3.13-slim
|
|
RUN useradd --system --uid 10001 --no-create-home scrobbler
|
|
WORKDIR /app
|
|
COPY --from=build /app/.venv /app/.venv
|
|
COPY gunicorn.conf.py docker/api-entrypoint.sh ./
|
|
# PROMETHEUS_MULTIPROC_DIR is set by gunicorn.conf.py for the API only: prometheus_client
|
|
# enters multiprocess mode whenever it's set, which other commands (the worker) don't want.
|
|
ENV PATH=/app/.venv/bin:$PATH \
|
|
PYTHONUNBUFFERED=1 \
|
|
BIND=0.0.0.0:8000 \
|
|
METRICS_PORT=9100 \
|
|
OPENAPI_DOCS_ENABLED=1
|
|
USER scrobbler
|
|
EXPOSE 8000 9100
|
|
HEALTHCHECK --interval=15s --timeout=3s --start-period=20s \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/healthz', timeout=2)"
|
|
ENTRYPOINT ["./api-entrypoint.sh"]
|
|
CMD ["gunicorn", "-c", "gunicorn.conf.py"]
|