Skip to content

Commit 5e57238

Browse files
authored
Refactor Dockerfile for CUDA and Python dependencies
Updated system dependencies and installation steps for Python and CUDA. Improved comments and organized the Dockerfile structure.
1 parent f1a50ad commit 5e57238

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

Docker/cuda/cuda.Dockerfile

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,49 @@
11
ARG CUDA_IMAGE=13.0.2-devel-ubuntu24.04
22
FROM nvidia/cuda:${CUDA_IMAGE}
33

4-
# Variables d'environnement de base
54
ENV DEBIAN_FRONTEND=noninteractive \
65
PYTHONDONTWRITEBYTECODE=1 \
76
PYTHONUNBUFFERED=1 \
87
HOST=0.0.0.0
98

10-
# Répertoire de travail
119
WORKDIR /app
1210

13-
# Dépendances système
11+
# Dépendances système pour Python + build C/C++ + OpenCL/BLAS
1412
RUN apt-get update && \
1513
apt-get upgrade -y && \
1614
apt-get install -y --no-install-recommends \
1715
git build-essential \
18-
python3 python3-pip python3-venv \
19-
gcc wget \
16+
python3 python3-pip python3-dev \
17+
cmake ninja-build \
18+
gcc g++ wget \
2019
ocl-icd-opencl-dev opencl-headers clinfo \
2120
libclblast-dev libopenblas-dev \
2221
&& mkdir -p /etc/OpenCL/vendors \
2322
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd \
2423
&& rm -rf /var/lib/apt/lists/*
2524

26-
# Copie du code
25+
# Copie du projet
2726
COPY . .
2827

29-
# Variables pour la build CUDA de llama-cpp
28+
# Variables pour la build CUDA de llama-cpp-python
3029
ENV CUDA_DOCKER_ARCH=all \
3130
GGML_CUDA=1 \
32-
CMAKE_ARGS="-DGGML_CUDA=on" \
33-
FORCE_CMAKE=1
31+
FORCE_CMAKE=1 \
32+
CMAKE_ARGS="-DGGML_CUDA=on"
3433

35-
# Installation des dépendances Python
36-
RUN python3 -m pip install --upgrade --no-cache-dir pip && \
34+
# Installer les deps Python générales
35+
RUN python3 -m pip install --upgrade --no-cache-dir pip wheel && \
3736
pip install --no-cache-dir \
38-
pytest cmake scikit-build setuptools \
37+
pytest scikit-build setuptools \
3938
fastapi uvicorn sse-starlette \
40-
pydantic-settings starlette-context && \
41-
pip install --no-cache-dir llama-cpp-python
39+
pydantic-settings starlette-context
40+
41+
# Installer llama-cpp-python avec CUDA
42+
# (tu peux fixer une version si besoin, ex: ==0.3.2)
43+
RUN pip install --no-cache-dir \
44+
"llama-cpp-python" \
45+
--verbose
4246

43-
# Port du serveur (optionnel mais pratique pour la doc)
4447
EXPOSE 8000
4548

46-
# Démarrage du serveur llama-cpp
4749
CMD ["python3", "-m", "llama_cpp.server", "--config_file", "config-cuda.json"]

0 commit comments

Comments
 (0)