Spaces:
Running
Running
| FROM python:3.11-slim | |
| LABEL maintainer="All API Collection" | |
| LABEL description="All API Collection" | |
| LABEL version="1.0.0" | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| curl \ | |
| ffmpeg \ | |
| git \ | |
| libmagic1 \ | |
| libxml2-dev \ | |
| libxslt-dev \ | |
| libffi-dev \ | |
| libssl-dev \ | |
| nodejs \ | |
| zlib1g-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN groupadd --gid 1000 appuser && \ | |
| useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu && \ | |
| python -m spacy download en_core_web_sm | |
| # SearXNG uses a rolling release model — master branch is the intended stable channel | |
| RUN git clone --depth 1 --branch master https://github.com/searxng/searxng.git /tmp/searxng && \ | |
| cd /tmp/searxng && \ | |
| pip install --no-cache-dir --use-pep517 --no-build-isolation -e . && \ | |
| rm -rf /tmp/searxng/.git | |
| COPY --chown=appuser:appuser . . | |
| RUN mkdir -p /app/models && python3 -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='ibm-granite/granite-embedding-small-english-r2', local_dir='/app/models/bge-384')" && chown -R appuser:appuser /app/models | |
| RUN mkdir -p /app/data /app/logs && \ | |
| chown -R appuser:appuser /app/data /app/logs | |
| RUN chmod +x /app/start.sh | |
| USER appuser | |
| ENV PYTHONPATH=/app | |
| ENV PYTHONUNBUFFERED=1 | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1 | |
| CMD ["/bin/bash", "/app/start.sh"] |