Spaces:
Sleeping
Sleeping
| # Dockerfile for Hugging Face Spaces | |
| FROM python:3.11-slim | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Install system dependencies for llama-cpp-python | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| git \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # Copy requirements and install Python dependencies | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy application files | |
| COPY --chown=user resume_microservice.py . | |
| COPY --chown=user download_model.py . | |
| # Create necessary directories | |
| RUN mkdir -p /tmp/uploads resume_parser/models | |
| # Expose port 7860 (required by Hugging Face Spaces) | |
| EXPOSE 7860 | |
| # Set environment variables | |
| ENV FLASK_RUN_HOST=0.0.0.0 | |
| ENV FLASK_RUN_PORT=7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=300s --retries=3 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Start the application | |
| CMD ["python", "resume_microservice.py"] |