File size: 805 Bytes
609d54c c8ef5ef 609d54c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# Use official Python image
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
git libheif-dev pkg-config \
libglib2.0-0 \
libasound2 libasound2-dev \
&& rm -rf /var/lib/apt/lists/*
# Create user (Hugging Face Spaces requirement)
RUN useradd -m -u 1000 user
# Switch to user early
USER user
# Set working directory
WORKDIR /home/user/app
# Set environment variables for Hugging Face Spaces
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
BASE_PATH=/home/user/app \
IS_DOCKER=True \
SERVER_PORT=7860
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy app code
COPY --chown=user . .
# Entry point
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |