FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ git bash curl tini build-essential zip unzip && \ rm -rf /var/lib/apt/lists/* # Create non-root user (HF requirement: uid 1000) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Install Python dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Copy application (including second_brain, watchdog, helix, swarm) COPY --chown=user . . # Create workspace directory RUN mkdir -p /tmp/workspace EXPOSE 7860 ENTRYPOINT ["tini", "--"] CMD ["python", "backend.py"]