FROM python:3.10-slim | |
# Install system dependencies including ffmpeg | |
RUN apt-get update && apt-get install -y ffmpeg libsndfile1 && apt-get clean | |
# Set working directory | |
WORKDIR /app | |
# Create cache and logs directories | |
RUN mkdir -p /app/cache /app/logs && chmod -R 777 /app/cache /app/logs | |
# Copy requirements and install | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Set environment variable for Hugging Face cache | |
ENV HF_HOME=/app/cache | |
# Expose Hugging Face Spaces port | |
EXPOSE 7860 | |
# Run the FastAPI app with uvicorn | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |