FROM python:3.11-slim # HF Spaces requires non-root user RUN useradd -m -u 1000 botuser WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy bot files COPY githubbot.py . # githubbot.env is optional — secrets come from HF environment variables COPY githubbot.env* ./ # Set permissions RUN chown -R botuser:botuser /app USER botuser # HF Spaces uses port 7860 EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860')" || exit 1 CMD ["python", "githubbot.py"]