Spaces:
Sleeping
Sleeping
| # Use a standard Python 3.11 slim image | |
| FROM python:3.11-slim | |
| RUN apt-get update && \ | |
| apt-get install -y tesseract-ocr poppler-utils libglib2.0-0 libsm6 libxext6 libxrender1 libgl1 && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Set up a new user named "user" with user ID 1000 (required by HF Spaces) | |
| RUN useradd -m -u 1000 user | |
| # Switch to the "user" user | |
| USER user | |
| # Set home to the user's home directory | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Copy the requirements file first to leverage Docker layer caching | |
| COPY --chown=user requirements.txt . | |
| # Install all your Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy all your project files into the container with proper ownership | |
| COPY --chown=user . . | |
| # Make our startup script executable | |
| RUN chmod +x ./start.sh | |
| # Hugging Face Spaces will set PORT env; default to 7860 if not set | |
| EXPOSE 7860 | |
| # Run the startup script when the container starts | |
| CMD ["./start.sh"] | |