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