Update Dockerfile
Browse files- Dockerfile +14 -3
Dockerfile
CHANGED
|
@@ -1,27 +1,38 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
# Install system dependencies for llama-cpp-python
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
libgl1 \
|
| 6 |
libglib2.0-0 \
|
| 7 |
libgomp1 \
|
| 8 |
build-essential \
|
| 9 |
python3-dev \
|
| 10 |
-
cmake \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
|
|
|
| 13 |
WORKDIR /app
|
| 14 |
|
|
|
|
| 15 |
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
-
# Pre-download the
|
|
|
|
| 19 |
RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='Qwen/Qwen2.5-7B-Instruct-GGUF', filename='qwen2.5-7b-instruct-q4_k_m.gguf')"
|
| 20 |
|
|
|
|
| 21 |
COPY . .
|
| 22 |
|
|
|
|
| 23 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 24 |
ENV GRADIO_SERVER_PORT="7860"
|
|
|
|
|
|
|
| 25 |
EXPOSE 7860
|
| 26 |
|
|
|
|
| 27 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies for OpenCV, PaddlePaddle, and compiling llama-cpp-python
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
libgl1 \
|
| 6 |
libglib2.0-0 \
|
| 7 |
libgomp1 \
|
| 8 |
build-essential \
|
| 9 |
python3-dev \
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Set working directory
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
+
# Copy requirements and install
|
| 16 |
COPY requirements.txt .
|
| 17 |
+
|
| 18 |
+
# Install dependencies (llama-cpp-python will compile from source)
|
| 19 |
+
# Note: To enable CUDA for NVIDIA GPUs, add `ENV CMAKE_ARGS="-DGGML_CUDA=on"` before this step
|
| 20 |
+
# and use an `nvidia/cuda` base image instead of `python:3.10-slim`.
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
+
# Pre-download the local LLM weights into the Docker image cache
|
| 24 |
+
# so it doesn't download on every container start.
|
| 25 |
RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='Qwen/Qwen2.5-7B-Instruct-GGUF', filename='qwen2.5-7b-instruct-q4_k_m.gguf')"
|
| 26 |
|
| 27 |
+
# Copy application files
|
| 28 |
COPY . .
|
| 29 |
|
| 30 |
+
# Set environment variables for Gradio
|
| 31 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 32 |
ENV GRADIO_SERVER_PORT="7860"
|
| 33 |
+
|
| 34 |
+
# Expose the Gradio port
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
+
# Run the application
|
| 38 |
CMD ["python", "app.py"]
|