File size: 1,239 Bytes
7a064ce
 
 
fc3bf2a
8d817d1
fc3bf2a
 
 
7a064ce
 
8d817d1
fc3bf2a
 
 
 
 
 
 
 
 
 
 
 
7a064ce
 
fc3bf2a
7a064ce
fc3bf2a
7a064ce
fc3bf2a
 
 
7a064ce
 
fc3bf2a
 
 
 
 
 
 
 
 
 
 
 
7a064ce
fc3bf2a
 
 
bb68da2
 
 
 
 
7a064ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
FROM ghcr.io/astral-sh/uv:0.11.32 AS uv

FROM python:3.13-slim AS builder

LABEL maintainer="techtrans <phaethon@phaethon.llc>"

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 -"]