File size: 877 Bytes
224e5e3
a9dd3d9
224e5e3
dd9de16
224e5e3
dd9de16
224e5e3
a9dd3d9
224e5e3
 
 
 
 
 
 
 
a9dd3d9
dd9de16
 
a9dd3d9
224e5e3
61f3c61
224e5e3
 
 
 
dd9de16
 
 
224e5e3
 
 
 
 
 
 
dd9de16
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
FROM python:3.10-slim

ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/app/cache
ENV UPLOAD_DIR=/app/uploads
ENV NLTK_DATA=/tmp/nltk_data
ENV PORT=7860

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    gcc \
    python3-dev \
    libmagic1 \
    libmupdf-dev \
    poppler-utils \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /app/cache /app/uploads /app/static /app/images /tmp/nltk_data && \
    chmod -R 777 /app /tmp/nltk_data

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -U pip setuptools wheel && \
    pip install --no-cache-dir -r requirements.txt

RUN rm -rf /app/cache/* && \
    chmod -R 777 /app/cache

COPY . .

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:7860/health || exit 1

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]