Download Dockerfile from Ayush-003/ThinkOV2: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/spaces/Ayush-003/ThinkOV2/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Ayush-003/ThinkOV2/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Ayush-003/ThinkOV2/resolve/main/Dockerfile
1.74 kB
| # Multi-stage build for Grocify Chat Agent | |
| FROM python:3.11-slim as builder | |
| WORKDIR /app | |
| # Install build dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| g++ \ | |
| make \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements | |
| ARG USE_UV=0 | |
| COPY requirements.txt ./ | |
| # Install Python dependencies. If building with USE_UV=1, install uv and use it to sync | |
| # the requirements file for faster installs and better caching. Otherwise fall back to pip. | |
| RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \ | |
| if [ -f requirements.txt ]; then \ | |
| if [ "$USE_UV" = "1" ]; then \ | |
| pip install --no-cache-dir uv && \ | |
| uv pip sync requirements.txt; \ | |
| else \ | |
| pip install --no-cache-dir -r requirements.txt; \ | |
| fi \ | |
| fi | |
| # Production stage | |
| FROM python:3.11-slim | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV HF_HOME=/app/cache | |
| WORKDIR /app | |
| # Install runtime dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| libgomp1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Ensure cache and data directories exist | |
| RUN mkdir -p /app/cache /app/data/vectorstore && chmod -R 777 /app/cache /app/data | |
| # Copy installed packages from builder | |
| COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | |
| COPY --from=builder /usr/local/bin /usr/local/bin | |
| # Copy application files | |
| COPY . /app | |
| # Expose port for HuggingFace Spaces | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD python -c "import requests; requests.get('http://localhost:7860/health')" || exit 1 | |
| # Run the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |