# Use an official Python runtime as a parent image FROM python:3.11-slim # Set environment variables for Python ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 # Set environment variables for Hugging Face cache ENV TRANSFORMERS_CACHE=/app/cache \ HF_HOME=/app/cache # Set the working directory WORKDIR /app # Install system dependencies #RUN apt-get update && apt-get install -y \ # libgl1 \ # libglib2.0-0 \ # libsm6 \ # libxrender1 \ # libxext6 \ # file \ # && rm -rf /var/lib/apt/lists/* #adding the poppler #RUN apt-get update && apt-get install -y poppler-utils #adding the poppler #RUN apt-get update && apt-get install -y tesseract-ocr # Copy the requirements file into the container at /app COPY requirements.txt /app/ # Copy the rest of the application code to /app COPY blocks/ /app/blocks/ COPY generated_projects/ /app/generated_projects/ COPY static/ /app/static/ COPY static/assets/ /app/static/assets/ COPY . /app/ # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Create and set permissions for the cache directory RUN mkdir -p /app/cache /app/blocks /app/generated_projects /app/static /app/static/assets && \ chmod -R 777 /app/cache /app/blocks /app/generated_projects /app/static /app/static/assets # Set environment variables for Flask ENV FLASK_APP=app.py \ FLASK_ENV=production # Expose the port the app runs on EXPOSE 7860 # Command to run the application CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "0", "app:app"]