Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Prevent interactive prompts during installation | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| TZ=Asia/Tehran | |
| # Set the timezone | |
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| tesseract-ocr \ | |
| tesseract-ocr-fas \ | |
| libtesseract-dev \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| libpango-1.0-0 \ | |
| libpangocairo-1.0-0 \ | |
| git \ | |
| wget \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create app directory | |
| WORKDIR /app | |
| # Copy requirements first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY . . | |
| # Create necessary directories | |
| RUN mkdir -p /app/temp_uploads /app/logs /app/models | |
| # Set user permissions | |
| RUN chown -R 1000:1000 /app | |
| USER 1000 | |
| # Expose port | |
| EXPOSE 8000 | |
| # Start command with gunicorn | |
| CMD ["gunicorn", "webhook_api:create_api", "--workers", "4", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000"] |