Tomtom84 commited on
Commit
7b879b9
·
verified ·
1 Parent(s): 4ac6aa5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -43
Dockerfile CHANGED
@@ -1,57 +1,33 @@
1
- FROM python:3.12
2
-
3
- # Optional: zuerst llama-cpp-python bauen (cachebar)
4
- #RUN pip install --no-cache-dir --no-build-isolation llama-cpp-python
5
- # Danach: outetts (zieht llama-cpp-python nicht erneut)
6
- #RUN pip install --no-cache-dir --no-build-isolation outetts
7
 
 
8
  RUN apt-get update && \
9
- apt-get install -y \
10
- bash \
11
- git git-lfs \
12
- wget curl procps gnupg \
13
- build-essential cmake \
14
- htop vim nano && \
15
  rm -rf /var/lib/apt/lists/*
16
 
17
- # NVIDIA CUDA Keyring installieren (offizielle Methode seit 2024)
18
- RUN wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb && \
19
- dpkg -i cuda-keyring_1.1-1_all.deb && \
20
- apt-get update && \
21
- apt-get -y install cuda
22
-
23
- # CUDA ENV-Variablen setzen
24
- ENV PATH=/usr/local/cuda/bin:${PATH}
25
- ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
26
- ENV CUDAToolkit_ROOT=/usr/local/cuda
27
- ENV CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=86"
28
-
29
  RUN useradd -m -u 1000 user
30
  USER user
31
- ENV PATH="/home/user/.local/bin:$PATH"
32
- # ^ when run as `user`, pip installs executables there
33
-
34
  WORKDIR /app
 
 
35
 
36
- COPY --chown=user . /app
37
-
38
- # Wichtig: Isolation deaktivieren für llama-cpp-python Build
39
- RUN pip install --upgrade pip
40
-
41
- # Manuell Build-Werkzeuge bereitstellen
42
  RUN pip install --upgrade pip && \
43
- pip install \
44
- setuptools \
45
- wheel \
46
- packaging \
47
- ninja \
48
- scikit-build-core[pyproject]
49
 
50
- #RUN pip install --no-cache-dir --no-build-isolation torch==2.2.2
 
51
 
52
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
53
 
54
- RUN pip install flash-attn --no-build-isolation
 
55
 
56
- #CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", , "--ws", "auto", "--allow-websocket-origin", "*"]
57
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # GPU‑fertige Basis mit Python 3.10, CUDA 11.8, cuDNN 8
2
+ FROM pytorch/pytorch:2.2.2-cuda11.8-cudnn8-runtime
 
 
 
 
3
 
4
+ # System‑Tools (schlank halten!)
5
  RUN apt-get update && \
6
+ apt-get install -y git-lfs build-essential && \
 
 
 
 
 
7
  rm -rf /var/lib/apt/lists/*
8
 
9
+ # Non‑root‑User, weil Spaces das mögen
 
 
 
 
 
 
 
 
 
 
 
10
  RUN useradd -m -u 1000 user
11
  USER user
 
 
 
12
  WORKDIR /app
13
+ ENV PATH="/home/user/.local/bin:$PATH"
14
+ ENV HF_HOME=/app/.cache # HF‑Cache in deinem Schreib­verzeichnis
15
 
16
+ # Python-Abhängigkeiten
17
+ COPY --chown=user requirements.txt .
 
 
 
 
18
  RUN pip install --upgrade pip && \
19
+ pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
20
 
21
+ # Optional: flash‑attn (Ampere 86 wird erkannt, Wheel vorhanden)
22
+ RUN pip install --no-cache-dir flash-attn==2.5.2 --no-build-isolation
23
 
24
+ # Mount das geheime HF‑Token beim Build:
25
+ # Settings → Secrets → Name: HF_TOKEN (scope: "read")
26
+ #ARG HF_TOKEN
27
+ #RUN --mount=type=secret,id=HF_TOKEN \
28
+ # echo "machine huggingface.co login __token__ password $(cat /run/secrets/HF_TOKEN)" > ~/.netrc
29
 
30
+ # App‑Code
31
+ COPY --chown=user . /app
32
 
 
33
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]