anfastech's picture
Update Dockerfile
900bd70
raw
history blame contribute delete
787 Bytes
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies FIRST
RUN apt-get update && apt-get install -y \
libffi-dev \
libsndfile1 \
libasound2 \
libxt6 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install Python dependencies in CORRECT ORDER
# numpy MUST be first, before torch/torchaudio
RUN pip install --no-cache-dir "numpy>=1.24.0,<2.0.0"
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Expose port
EXPOSE 7860
# Run with proper Python settings
ENV PYTHONUNBUFFERED=1
# Run with uvicorn directly (required for HuggingFace Spaces)
# Use PORT environment variable if provided, otherwise default to 7860
CMD uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860} --log-level info