Spaces:
Sleeping
Sleeping
File size: 1,548 Bytes
bdf22b9 08338b4 bdf22b9 3aae586 bdf22b9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# 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"] |