AI_Audio / Dockerfile
Zurya's picture
Create Dockerfile
6192015 verified
Raw
History Blame Contribute Delete
751 Bytes
# Use a slim Python image to keep the build fast
FROM python:3.9-slim
# Install system dependencies for audio processing (ffmpeg is required by librosa)
RUN apt-get update && apt-get install -y ffmpeg libsndfile1
WORKDIR /app
# Create a user to avoid running as root (Hugging Face security requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy and install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your app code
COPY --chown=user . .
# Expose the default Hugging Face port
EXPOSE 7860
# Start the FastAPI server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]