| FROM python:3.10-slim |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| ffmpeg \ |
| libsm6 \ |
| libxext6 \ |
| libgl1 \ |
| libgles2 \ |
| libegl1 \ |
| libmagic1 \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 user |
| USER user |
|
|
| |
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH \ |
| PYTHONUNBUFFERED=1 \ |
| HF_HOME=/tmp/.cache/huggingface |
|
|
| WORKDIR $HOME/app/backend |
|
|
| |
| RUN pip install --no-cache-dir \ |
| torch torchvision --index-url https://download.pytorch.org/whl/cpu |
|
|
| |
| COPY --chown=user:user backend/requirements.txt . |
| RUN pip install --no-cache-dir -r requirements.txt && \ |
| pip uninstall -y opencv-python opencv-python-headless opencv-contrib-python 2>/dev/null || true; \ |
| pip install --no-cache-dir opencv-contrib-python-headless |
|
|
| |
| COPY --chown=user:user backend/ . |
|
|
| |
| RUN mkdir -p uploads reports weights |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |
|
|