FROM python:3.11 # Create user RUN useradd -m -u 1000 user # Set working directory WORKDIR /home/user/app # Create necessary directories with correct permissions RUN mkdir -p /home/user/app/public RUN mkdir -p /home/user/app/logs RUN chown -R user:user /home/user/app # Copy requirements first COPY --chown=user requirements.txt . RUN pip install -r requirements.txt # Copy the rest of the application COPY --chown=user . . # HF Spaces specific: Listen on 0.0.0.0 to accept external connections ENV HOST=0.0.0.0 ENV PORT=7860 # Document that the container listens on port 7860 EXPOSE 7860 # Set user USER user # Command to run the application CMD ["chainlit", "run", "scripts/demo.py", "--port", "7860", "--host", "0.0.0.0", "-h"]