Spaces:
Sleeping
Sleeping
| FROM python:3.9 | |
| # Switch to root for system installations | |
| USER root | |
| # Install Tesseract and language data | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create user and set up environment | |
| RUN useradd -m -u 1000 user | |
| # Clone the repository and set up directories | |
| RUN --mount=type=secret,id=Access_key,mode=0444,required=true \ | |
| git clone $(cat /run/secrets/Access_key) /app && \ | |
| mkdir -p /app/temp /app/uploads /app/files && \ | |
| chown -R user:user /app && \ | |
| chmod -R 755 /app && \ | |
| chmod -R 777 /app/temp && \ | |
| chmod -R 777 /app/uploads && \ | |
| chmod -R 777 /app/files | |
| # Set working directory | |
| WORKDIR /app | |
| # Switch to user for pip installations | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Expose port 7860 | |
| EXPOSE 7860 | |
| # Start the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |