# Use NVIDIA CUDA base image for GPU support # For CPU-only, use: FROM python:3.11-slim FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 # Install Python and system dependencies RUN apt-get update && apt-get install -y \ python3.11 \ python3-pip \ ffmpeg \ git \ gcc \ build-essential \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements COPY requirements.txt . # Install build dependencies for madmom RUN pip3 install --no-cache-dir Cython 'numpy<2.0.0' # Install Python dependencies RUN pip3 install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create a wrapper script to patch torchaudio to use soundfile backend RUN echo '#!/bin/bash\n\ # Force torchaudio to use soundfile backend\n\ export TORCHAUDIO_USE_BACKEND_DISPATCHER=0\n\ exec celery -A tasks worker --loglevel=info --concurrency=1\n\ ' > /app/start-worker.sh && chmod +x /app/start-worker.sh # Default command CMD ["/app/start-worker.sh"]