Update Dockerfile
Browse files123456789101112131415161718192021222324252627282930# Base image with Python and PytorchFROM python:3.11-slim# Install system dependenciesRUN apt-get update && apt-get install -y \tesseract-ocr \libglib2.0-0 \libsm6 \libxext6 \libxrender-dev \&& rm -rf /var/lib/apt/lists/*# Set workdirWORKDIR /app# Copy requirements first and install themCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt# Download transformer model at build timeRUN python -c "from transformers import pipeline; pipeline('summarization', model='t5-base', cache_dir='/app/model')"# Copy your app codeCOPY app/ .# Expose portEXPOSE 7860# Run appCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]1234567891011121314151617181920212223242526272829303132333435363738# Base image with Python and Pytorch (swap slim for full if more libs needed)FROM python:3.11-slim# Install system dependenciesRUN apt-get update && apt-get install -y \tesseract-ocr \libglib2.0-0 \libsm6 \libxext6 \libxrender-dev \&& rm -rf /var/lib/apt/lists/*# Set working directoryWORKDIR /app# Copy requirements and install themCOPY requirements.txt .# Install Python dependencies — add torch explicitlyRUN pip install --no-cache-dir torch transformers uvicorn fastapi pdfplumber pytesseract newspaper3k# Create model cache directory with full permissionsRUN mkdir -p /app/model && chmod -R 777 /app/model# Set TRANSFORMERS_CACHE env var for caching models to /app/modelENV TRANSFORMERS_CACHE=/app/model# Download and cache T5 model at build timeRUN python -c "from transformers import pipeline; pipeline('summarization', model='t5-base', cache_dir='/app/model')"# Copy your application code into containerCOPY app/ .# Expose your application portEXPOSE 7860# Run the FastAPI application with UvicornCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
Dockerfile+38-30