FROM python:3.12-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ curl sqlite3 \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN mkdir -p /app/data /app/parser_data COPY tracker/ tracker/ COPY static/ static/ COPY seed/ seed/ COPY data/tracker.db /app/data/tracker.db COPY config.yaml config.yaml COPY hf_spaces.yaml hf_spaces.yaml COPY agent_profile.yaml agent_profile.yaml COPY scripts/hf_entrypoint.sh scripts/hf_entrypoint.sh RUN python <<'PY' import sqlite3 from pathlib import Path Path("/app/parser_data").mkdir(parents=True, exist_ok=True) for name in ("user.db", "web_query.db", "web_cache.db"): sqlite3.connect("/app/parser_data/" + name).close() Path("/app/data/tracker.db").touch(exist_ok=True) PY RUN chmod +x scripts/hf_entrypoint.sh \ && chown -R 1000:1000 /app USER 1000 EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=5s --start-period=25s --retries=3 \ CMD curl -fsS http://127.0.0.1:7860/health || exit 1 CMD ["bash", "scripts/hf_entrypoint.sh"]