35 lines
1.0 KiB
Docker
35 lines
1.0 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# Single image serves both `api` and `worker` (different commands in compose).
|
|
FROM python:3.14-slim AS base
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
UV_LINK_MODE=copy \
|
|
VIRTUAL_ENV=/app/.venv \
|
|
PATH="/app/.venv/bin:$PATH"
|
|
|
|
# Runtime tools: ffmpeg (transcode/HLS), fpcalc (Chromaprint fingerprinting).
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ffmpeg libchromaprint-tools \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:0.4 /uv /uvx /bin/
|
|
|
|
WORKDIR /app
|
|
|
|
# Dependency layer — cached unless lockfile changes.
|
|
COPY pyproject.toml uv.lock* ./
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen --no-install-project --no-dev
|
|
|
|
# Project layer.
|
|
COPY . .
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen --no-dev
|
|
|
|
EXPOSE 8000
|
|
|
|
# Default: API server. Worker overrides command in docker-compose.
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|