| FROM python:3.9-slim |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| git \ |
| build-essential \ |
| gcc \ |
| g++ \ |
| make \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install --no-cache-dir torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 || \ |
| (echo "torch 2.4.1 failed, trying 2.3.1..." && \ |
| pip install --no-cache-dir torch==2.3.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121) |
|
|
| |
| COPY requirements.txt /tmp/requirements.txt |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt |
|
|
| |
| COPY app.py /app/app.py |
|
|
| |
| |
| COPY examples/ /app/examples/ |
|
|
| |
| WORKDIR /app |
|
|
| |
| ENV OMP_NUM_THREADS=1 |
| ENV MKL_NUM_THREADS=1 |
| ENV NUMEXPR_NUM_THREADS=1 |
|
|
| |
| CMD ["python", "app.py"] |
|
|
|
|