FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 # Set environment variables for cache directories and fixes ENV TRANSFORMERS_CACHE=/app/.cache/huggingface ENV HF_HOME=/app/.cache/huggingface ENV MPLCONFIGDIR=/app/.cache/matplotlib ENV FONTCONFIG_PATH=/etc/fonts ENV FONTCONFIG_FILE=/etc/fonts/fonts.conf ENV FC_CACHEDIR=/app/.cache/fontconfig ENV OMP_NUM_THREADS=1 ENV PYTHONUNBUFFERED=1 ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/lib/x86_64-linux-gnu/" # Install Python 3.10 and system dependencies RUN apt-get update && apt-get install -y \ python3.10 \ python3-pip \ ffmpeg \ git \ wget \ fonts-noto-core \ fonts-noto-ui-core \ fontconfig \ && rm -rf /var/lib/apt/lists/* # Download Devanagari fonts manually from GitHub RUN mkdir -p /usr/share/fonts/truetype/noto && \ cd /usr/share/fonts/truetype/noto && \ wget -q https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/NotoSansDevanagari/NotoSansDevanagari-Regular.ttf && \ wget -q https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/NotoSansDevanagari/NotoSansDevanagari-Bold.ttf && \ fc-cache -fv # Verify fonts are installed RUN fc-list | grep -i devanagari || echo "Devanagari fonts installed manually" # Set working directory WORKDIR /app # Create cache directories with proper permissions RUN mkdir -p /app/.cache/huggingface /app/.cache/matplotlib /app/.cache/fontconfig && \ chmod -R 777 /app/.cache # Copy requirements and install Python packages COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt # Copy application COPY app.py . # Expose Gradio port EXPOSE 7860 # Run the app CMD ["python3", "app.py"]