Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| TRANSFORMERS_CACHE=/app/model_cache \ | |
| HF_HOME=/app/.cache/huggingface \ | |
| SENTENCE_TRANSFORMERS_HOME=/app/.cache/huggingface/sentence-transformers | |
| # Create working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg libsndfile1 \ | |
| ca-certificates curl dnsutils gcc openssl && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt | |
| # Create writable model cache directory and set correct ownership | |
| RUN mkdir -p /app/model_cache /app/.cache/huggingface && \ | |
| chown -R 1000:1000 /app/model_cache /app/.cache/huggingface | |
| # Copy app source code | |
| COPY . . | |
| # Expose app port | |
| EXPOSE 7860 | |
| # Run app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"] | |