ALDDS / Dockerfile
LovnishVerma's picture
Update Dockerfile
84b2f49 verified
Raw
History Blame Contribute Delete
1.52 kB
FROM python:3.10-slim
# Install system dependencies for OpenCV and PaddlePaddle
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# 1. Install huggingface-hub first to download the model.
# This isolates the 4.7GB download layer. If you change requirements.txt or app.py,
# Docker will CACHE this download layer and NEVER pull the 4.7GB model again!
RUN pip install --no-cache-dir huggingface-hub
# 2. Download LLM weights early in the building phase.
# Points to Bartowski's stable and verified repository path to resolve the 404 error.
RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='Bartowski/Qwen2.5-7B-Instruct-GGUF', filename='Qwen2.5-7B-Instruct-Q4_K_M.gguf')"
# 3. Force the pre-compiled CPU wheel for instant installation
RUN pip install --no-cache-dir llama-cpp-python \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
--only-binary llama-cpp-python
# 4. Copy and install the rest of the dependencies from requirements.txt
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 5. Copy application files (changes to app.py will only invalidate this quick layer)
COPY . .
# Set environment variables for Gradio
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT="7860"
# Expose the Gradio port
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]