AnatoliiG commited on
Commit
9ef242b
·
1 Parent(s): 0fb3706

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -37
Dockerfile CHANGED
@@ -1,52 +1,27 @@
1
- # --- ЭТАП 1: Сборщик (Builder) ---
2
- # Используем тот же образ, что и в финале, чтобы версии библиотек совпадали
3
- FROM python:3.10-slim as builder
4
-
5
- # Отключаем буферизацию и лишние файлы
6
- ENV PYTHONUNBUFFERED=1 \
7
- PYTHONDONTWRITEBYTECODE=1
8
 
9
  WORKDIR /app
10
 
11
- RUN apt-get update && apt-get install -y --no-install-recommends \
12
- build-essential \
13
- cmake \
14
- python3-dev \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
- RUN pip install --upgrade pip setuptools wheel
18
-
19
- RUN CMAKE_ARGS="-DGGML_BLAS=OFF" pip wheel --no-cache-dir --wheel-dir /wheels \
20
- llama-cpp-python
21
 
22
- FROM python:3.10-slim
23
-
24
- WORKDIR /app
25
 
26
- # Настраиваем переменные
27
- ENV PYTHONUNBUFFERED=1 \
28
- HF_HOME=/home/user/cache \
29
- HOME=/home/user \
30
- PATH=/home/user/.local/bin:$PATH
31
 
32
- RUN apt-get update && apt-get install -y --no-install-recommends \
33
- curl \
34
- libgomp1 \
35
- && rm -rf /var/lib/apt/lists/*
36
 
37
- # Создаем пользователя
38
  RUN useradd -m -u 1000 user
39
  USER user
40
- RUN mkdir -p $HF_HOME
41
-
42
- COPY --from=builder /wheels /wheels
43
-
44
- COPY --chown=user requirements.txt requirements.txt
45
- RUN pip install --no-cache-dir --upgrade pip && \
46
- pip install --no-cache-dir -r requirements.txt && \
47
- pip install --no-cache-dir /wheels/*.whl
48
 
49
- COPY --chown=user app.py app.py
 
50
 
51
  EXPOSE 7860
52
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.10-slim
 
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ RUN apt-get update && apt-get install -y \
6
+ wget \
 
 
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
+ RUN wget https://github.com/abetlen/llama-cpp-python/releases/download/v0.2.90/llama_cpp_python-0.2.90-cp310-cp310-linux_x86_64.whl -O llama_cpp_python.whl
 
 
 
10
 
11
+ COPY requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
 
13
 
14
+ RUN pip install llama_cpp_python.whl
 
 
 
 
15
 
16
+ RUN rm llama_cpp_python.whl
 
 
 
17
 
 
18
  RUN useradd -m -u 1000 user
19
  USER user
20
+ ENV HOME=/home/user \
21
+ PATH=/home/user/.local/bin:$PATH
 
 
 
 
 
 
22
 
23
+ WORKDIR /app
24
+ COPY --chown=user app.py .
25
 
26
  EXPOSE 7860
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]