visalitako / Dockerfile
j4mouser's picture
Upload 3 files
bb3273a verified
raw
history blame contribute delete
857 Bytes
# Hugging Face Spaces Dockerfile for SalitaKo Backend
FROM python:3.11-slim
# Install system dependencies for audio processing
RUN apt-get update && apt-get install -y \
ffmpeg \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user (required by HF Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy requirements first for caching
COPY --chown=user requirements-hf.txt requirements.txt
# Install Python dependencies (CPU-only torch for free tier)
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user . .
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Run the FastAPI app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]