FROM python:3.11-slim # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 ENV TRANSFORMERS_CACHE=/app/data/cache ENV HF_HOME=/app/data/cache # Install system dependencies RUN apt-get update && apt-get install -y \ git \ ffmpeg \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create necessary directories RUN mkdir -p data/saves data/models data/cache logs config # Expose port EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 # Run the application CMD ["python", "app.py"]