forked from zylon-ai/private-gpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
86 lines (69 loc) · 1.94 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
### IMPORTANT, THIS IMAGE CAN ONLY BE RUN IN LINUX DOCKER
### You will run into a segfault in mac
# Use NVIDIA CUDA base image
FROM nvidia/cuda:11.7.1-devel-ubuntu22.04 as base
ENV PYTHON_VERSION=3.11.6
ENV TZ_SELECTION=2
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
wget \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
llvm \
libncurses5-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libffi-dev \
liblzma-dev \
&& \
rm -rf /var/lib/apt/lists/*
ENV HOME="/root"
WORKDIR ${HOME}
RUN apt-get install -y git
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv
ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
RUN pyenv install ${PYTHON_VERSION}
RUN pyenv global ${PYTHON_VERSION}
# Verify Python installation
RUN python --version
# Install poetry
RUN pip install pipx
RUN python3.11 -m pipx ensurepath
RUN pipx install poetry
ENV PATH="/root/.local/bin:$PATH"
# Dependencies to build llama-cpp
RUN apt update && apt install -y \
libopenblas-dev\
ninja-build\
build-essential\
pkg-config\
wget
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
FROM base as dependencies
WORKDIR /saimon
COPY pyproject.toml poetry.lock ./
RUN poetry install --with local
RUN poetry install --with ui
# GPU SUPPORT FOR LLAMA
RUN CMAKE_ARGS='-DLLAMA_CUBLAS=on' poetry run pip install --force-reinstall --no-cache-dir llama-cpp-python
FROM base as app
ENV PYTHONUNBUFFERED=1
ENV PORT=8080
WORKDIR /saimon
COPY . .
RUN mkdir local_data
RUN mkdir models
COPY --from=dependencies /saimon/.venv/ .venv
RUN poetry run python setup
ENV PGPT_PROFILES=local
ENTRYPOINT .venv/bin/python -u -m private_gpt