FROM python:3.10-slim # Create a non-root user (UID 1000) RUN useradd -m -u 1000 user # Set the working directory WORKDIR /app # Copy all files into /app COPY . /app # (Optional) Adjust permissions RUN chown -R user:user /app RUN chmod -R 777 /app # Switch to non-root user USER user # Set environment variables ENV HF_HOME=/app/.cache \ HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Expose the port for Hugging Face Spaces EXPOSE 7860 # Run Chainlit when the container starts CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]