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