| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Install dependencies | |
| RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Environment variables for caching | |
| ENV HF_HOME=/app/hf_cache | |
| ENV MODEL_REPO="Qwen/Qwen2.5-0.5B-Instruct" | |
| ENV CACHE_DIR=/app/models | |
| # Create cache directories | |
| RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME \ | |
| && mkdir -p $CACHE_DIR && chmod -R 777 $CACHE_DIR | |
| # Download the model at build time | |
| # Copy app code | |
| COPY app.py . | |
| RUN chmod -R 777 /app | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] |