|
1 | 1 | ARG CUDA_IMAGE=13.0.2-devel-ubuntu24.04 |
2 | 2 | FROM nvidia/cuda:${CUDA_IMAGE} |
3 | 3 |
|
4 | | -# Variables d'environnement de base |
5 | 4 | ENV DEBIAN_FRONTEND=noninteractive \ |
6 | 5 | PYTHONDONTWRITEBYTECODE=1 \ |
7 | 6 | PYTHONUNBUFFERED=1 \ |
8 | 7 | HOST=0.0.0.0 |
9 | 8 |
|
10 | | -# Répertoire de travail |
11 | 9 | WORKDIR /app |
12 | 10 |
|
13 | | -# Dépendances système |
| 11 | +# Dépendances système pour Python + build C/C++ + OpenCL/BLAS |
14 | 12 | RUN apt-get update && \ |
15 | 13 | apt-get upgrade -y && \ |
16 | 14 | apt-get install -y --no-install-recommends \ |
17 | 15 | 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 \ |
20 | 19 | ocl-icd-opencl-dev opencl-headers clinfo \ |
21 | 20 | libclblast-dev libopenblas-dev \ |
22 | 21 | && mkdir -p /etc/OpenCL/vendors \ |
23 | 22 | && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd \ |
24 | 23 | && rm -rf /var/lib/apt/lists/* |
25 | 24 |
|
26 | | -# Copie du code |
| 25 | +# Copie du projet |
27 | 26 | COPY . . |
28 | 27 |
|
29 | | -# Variables pour la build CUDA de llama-cpp |
| 28 | +# Variables pour la build CUDA de llama-cpp-python |
30 | 29 | ENV CUDA_DOCKER_ARCH=all \ |
31 | 30 | GGML_CUDA=1 \ |
32 | | - CMAKE_ARGS="-DGGML_CUDA=on" \ |
33 | | - FORCE_CMAKE=1 |
| 31 | + FORCE_CMAKE=1 \ |
| 32 | + CMAKE_ARGS="-DGGML_CUDA=on" |
34 | 33 |
|
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 && \ |
37 | 36 | pip install --no-cache-dir \ |
38 | | - pytest cmake scikit-build setuptools \ |
| 37 | + pytest scikit-build setuptools \ |
39 | 38 | 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 |
42 | 46 |
|
43 | | -# Port du serveur (optionnel mais pratique pour la doc) |
44 | 47 | EXPOSE 8000 |
45 | 48 |
|
46 | | -# Démarrage du serveur llama-cpp |
47 | 49 | CMD ["python3", "-m", "llama_cpp.server", "--config_file", "config-cuda.json"] |
0 commit comments