FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim

WORKDIR /app

# Force uv to use the system Python instead of downloading its own
ENV UV_PYTHON_DOWNLOADS=never \
  UV_COMPILE_BYTECODE=1 \
  UV_LINK_MODE=copy \
  PYTHONUNBUFFERED=1

# Install locked dependencies first so code changes don't invalidate this layer
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev

# Then copy the application itself
COPY main.py formater.py image.py ./
COPY assets ./assets

# Put the venv on PATH so `python` resolves to the venv interpreter
ENV PATH="/app/.venv/bin:$PATH"

CMD ["python", "main.py"]
