| |
| FROM python:3.10-slim |
|
|
| |
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| git \ |
| wget \ |
| curl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY requirements.txt . |
|
|
| |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu && \ |
| pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY . . |
|
|
| |
| ENV PYTHONPATH=/app |
| ENV TORCH_HOME=/tmp/torch |
| ENV HF_HOME=/tmp/huggingface |
| ENV TRANSFORMERS_CACHE=/tmp/transformers |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \ |
| CMD curl -f http://localhost:7860/health || exit 1 |
|
|
| |
| CMD ["python", "app.py"] |
|
|