radiology-api / Dockerfile
MakPr016
Updated Dockerfile
7959a17
FROM python:3.11-slim
WORKDIR /app
ENV TRANSFORMERS_CACHE=/tmp/cache
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/cache
ENV HF_HOME=/tmp/cache
ENV TORCH_HOME=/tmp/cache
ENV EASYOCR_MODULE_PATH=/tmp/cache
RUN mkdir -p /tmp/cache && chmod 777 /tmp/cache
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
poppler-utils \
tesseract-ocr \
tesseract-ocr-eng \
libmagic1 \
git \
git-lfs \
curl \
wget \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
RUN python -m spacy download en_core_web_sm
RUN python -c "import easyocr; easyocr.Reader(['en'], gpu=False, download_enabled=True)"
COPY app/ ./app/
RUN mkdir -p models/xray_ner_best && \
git clone https://huggingface.co/MakPr016/radiology-ner-model models/xray_ner_best
ENV HOST=0.0.0.0
ENV PORT=7860
ENV MODEL_PATH=./models/xray_ner_best
ENV PYTHONUNBUFFERED=1
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]