| FROM python:3.10-slim |
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| git wget build-essential cmake \ |
| tesseract-ocr libtesseract-dev libleptonica-dev \ |
| libgl1 libglib2.0-0 libsm6 libxrender1 libxext6 \ |
| && apt-get clean && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY requirements.txt . |
|
|
| |
| RUN pip install --upgrade pip |
|
|
| |
| RUN pip install torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cpu |
|
|
| |
| RUN pip install setuptools wheel ninja |
|
|
| |
| RUN pip install --no-build-isolation 'git+https://github.com/facebookresearch/detectron2.git@main' |
|
|
| |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY . . |
|
|
| |
| ENV FVCORE_CACHE=/root/.torch/iopath_cache |
| ENV TORCH_HOME=/root/.torch |
|
|
| |
| RUN mkdir -p /root/.torch/iopath_cache/s/dgy9c10wykk4lq4 && \ |
| mkdir -p /root/.torch/iopath_cache/s/u9t7pqwz79q8kw5 && \ |
| chmod -R 777 /root/.torch && \ |
| wget -q --show-progress https://www.dropbox.com/s/dgy9c10wykk4lq4/model_final.pth?dl=1 \ |
| -O /root/.torch/iopath_cache/s/dgy9c10wykk4lq4/model_final.pth && \ |
| wget -q --show-progress https://www.dropbox.com/s/u9t7pqwz79q8kw5/config.yml?dl=1 \ |
| -O /root/.torch/iopath_cache/s/u9t7pqwz79q8kw5/config.yml && \ |
| echo "✓ Model files downloaded successfully" |
|
|
| EXPOSE 8080 |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"] |