Spaces:
Running
Running
| FROM python:3.11-slim | |
| LABEL maintainer="All API Collection" | |
| LABEL description="All API Collection - Document extraction, conversion, and database query API" | |
| LABEL version="1.0.0" | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| ffmpeg \ | |
| libmagic1 \ | |
| nodejs \ | |
| && 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 | |
| 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/logs && \ | |
| chown -R appuser:appuser /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"] |