Display name only: UI, docs, API title, dashboards, hashtag and User-Agent. Identifiers (package, metrics, env vars, SCROBBLER_CONFIG) are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
34 lines
1.4 KiB
Docker
34 lines
1.4 KiB
Docker
# Scrobbled 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
|
|
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
|
|
RUN useradd --system --uid 10001 --no-create-home scrobbler
|
|
# Downloaded album art lives here, on a volume shared with the worker (which writes it).
|
|
RUN mkdir -p /data/album-art && chown scrobbler:scrobbler /data/album-art
|
|
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"]
|