Vlm-test / Dockerfile
mike23415's picture
Update Dockerfile
60328d6 verified
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"]