FROM ghcr.io/astral-sh/uv:0.11.32 AS uv FROM python:3.13-slim AS builder LABEL maintainer="techtrans " ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ UV_COMPILE_BYTECODE=1 \ UV_LINK_MODE=copy \ PORT=7860 \ PYTHONPATH=/app WORKDIR /app RUN apt-get update \ && apt-get install -y --no-install-recommends \ build-essential \ tesseract-ocr \ poppler-utils \ libgl1 \ && rm -rf /var/lib/apt/lists/* COPY --from=uv /uv /uvx /bin/ COPY pyproject.toml uv.lock ./ RUN uv sync --locked --no-dev FROM python:3.13-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PORT=7860 \ PATH="/app/.venv/bin:$PATH" WORKDIR /app RUN apt-get update \ && apt-get install -y --no-install-recommends \ tesseract-ocr \ poppler-utils \ libgl1 \ wget \ ca-certificates \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/.venv /app/.venv COPY . . USER root COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["bash", "-lc", "exec /app/.venv/bin/gunicorn 'app:create_app()' --bind 0.0.0.0:${PORT} --workers 1 --threads 1 --timeout ${GUNICORN_TIMEOUT:-3500} --access-logfile - --error-logfile -"]