# Use official Python image FROM python:3.10 # Install curl and other necessary tools RUN apt-get update && apt-get install -y curl libsndfile1 && rm -rf /var/lib/apt/lists/* # Set up user and directory (HF Spaces runs with UID 1000) RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app # Install CPU PyTorch first (to save space and download size) RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu # Install other python dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application files COPY --chown=user . /app # Ensure startup script is executable RUN chmod +x /app/start.sh # Start the services CMD ["/app/start.sh"]