File size: 1,215 Bytes
1211a77 60328d6 1211a77 60328d6 1211a77 60328d6 345dd3e 60328d6 345dd3e 1211a77 60328d6 1211a77 |
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 |
FROM python:3.10-slim
# Avoid interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies
RUN apt-get update && apt-get install -y \
libglib2.0-0 libsm6 libxext6 libxrender-dev poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Create app directory and cache directories
WORKDIR /app
RUN mkdir -p /app/.cache && \
mkdir -p /.cache && \
chmod -R 777 /app && \
chmod -R 777 /.cache
# Set environment variables for HuggingFace cache
ENV HF_HOME=/app/.cache
ENV TRANSFORMERS_CACHE=/app/.cache
ENV HF_DATASETS_CACHE=/app/.cache
ENV HUGGINGFACE_HUB_CACHE=/app/.cache
ENV TORCH_HOME=/app/.cache
# Copy files
COPY app.py requirements.txt ./
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download models to avoid runtime download issues (optional but recommended)
# Uncomment the next line if you want to download models during build
# RUN python -c "from transformers import DonutProcessor, VisionEncoderDecoderModel; DonutProcessor.from_pretrained('naver-clova-ix/donut-base'); VisionEncoderDecoderModel.from_pretrained('naver-clova-ix/donut-base')"
# Expose port for Hugging Face
EXPOSE 7860
# Run the app
CMD ["python", "app.py"] |