FROM python:3.11-slim WORKDIR /app # Install system dependencies for audio processing RUN apt-get update && apt-get install -y \ ffmpeg \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install CPU-only PyTorch first (MUCH smaller than GPU version) RUN pip install --no-cache-dir torch==2.1.2+cpu torchaudio==2.1.2+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html # Install remaining requirements (skip torch/torchaudio since already installed) RUN pip install --no-cache-dir -r requirements.txt || true # Copy application code COPY . . # Expose port (documentary only, but good practice) EXPOSE 8000 # Run the application using shell form to expand PORT variable # Railway (and others) often inject a generic PORT variable CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860}"]