# Use Python 3.11 base image FROM python:3.11.9-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ wget \ curl \ build-essential \ gcc \ g++ \ python3-dev \ libsndfile1 \ libsndfile1-dev \ ffmpeg \ libasound2-dev \ portaudio19-dev \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Make startup script executable RUN chmod +x start.sh # Create cache directories with proper permissions RUN mkdir -p /tmp/hf_cache /tmp/numba_cache && chmod 777 /tmp/hf_cache /tmp/numba_cache # Set environment variables ENV HF_HOME=/tmp/hf_cache ENV PYTHONPATH=/app ENV NUMBA_CACHE_DIR=/tmp/numba_cache ENV NUMBA_DISABLE_JIT=1 # Expose port EXPOSE 7860 # Set environment variable for port ENV PORT=7860 # Run the application with startup script CMD ["./start.sh"]