Files
vidconf/backend/Dockerfile

41 lines
1.6 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM python:3.12-slim AS base
# uv binary, pinned via digest-less tag (see astral-sh/uv releases)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
WORKDIR /app
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
PYTHONUNBUFFERED=1
# Экстра-группа `gpu` (ADR-004: cuBLAS/cuDNN9 для FasterWhisperGPU,
# `core/plugins/faster_whisper.py`) — ставится ТОЛЬКО в GPU-образе воркера
# транскрибации (deploy/docker-compose.yml, сервис `worker-transcriber-gpu`,
# `build.args.WITH_GPU_EXTRA: "true"`, профиль `transcribe-gpu`); базовый
# CPU-образ backend/worker/worker-transcriber собирается с дефолтом "false"
# — не тянет нативные CUDA-библиотеки туда, где GPU нет.
ARG WITH_GPU_EXTRA=false
# Install dependencies first (better layer caching), then copy source.
COPY pyproject.toml uv.lock ./
RUN if [ "$WITH_GPU_EXTRA" = "true" ]; then \
uv sync --frozen --no-dev --no-install-project --extra gpu; \
else \
uv sync --frozen --no-dev --no-install-project; \
fi
COPY . .
RUN if [ "$WITH_GPU_EXTRA" = "true" ]; then \
uv sync --frozen --no-dev --extra gpu; \
else \
uv sync --frozen --no-dev; \
fi
EXPOSE 8000
HEALTHCHECK --interval=10s --timeout=5s --retries=10 --start-period=15s \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')" || exit 1
CMD ["uv", "run", "uvicorn", "main:create_app", "--factory", "--host", "0.0.0.0", "--port", "8000"]