localailb/assistant
0
1FROM python:3.11-slim2 3# Install system dependencies4RUN apt-get update && apt-get install -y --no-install-recommends \5 build-essential \6 curl \7 git \8 ffmpeg \9 libsm6 \10 libxext6 \11 poppler-utils \12 && rm -rf /var/lib/apt/lists/*13 14# Create user for Hugging Face Spaces (UID 1000)15RUN useradd -m -u 1000 user16USER user17ENV HOME=/home/user \18 PATH=/home/user/.local/bin:$PATH \19 PYTHONUNBUFFERED=1 \20 MPLBACKEND=Agg \21 HF_HUB_DISABLE_TELEMETRY=1 \22 DO_NOT_TRACK=123 24WORKDIR $HOME/app25 26# Install Python requirements27COPY --chown=user:user requirements.txt $HOME/app/requirements.txt28RUN pip install --no-cache-dir --upgrade pip && \29 pip install --no-cache-dir -r requirements.txt30 31# Copy application source code32COPY --chown=user:user . $HOME/app33 34# Ensure user_data directory is writable35RUN mkdir -p $HOME/app/user_data && chmod -R 777 $HOME/app/user_data36 37EXPOSE 786038 39CMD ["uvicorn", "backend.web_api:app", "--host", "0.0.0.0", "--port", "7860"]40 