-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Dockerfile-GPU
39 lines (37 loc) · 1.79 KB
/
Dockerfile-GPU
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
###############################################
# Base Image
###############################################
FROM nvidia/cuda:12.1.1-base-ubuntu22.04 as base
# We set POETRY_VERSION=1.3.2 because 1.4.x has some weird legacy issues
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_VERSION=1.3.2
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y software-properties-common && add-apt-repository -y ppa:deadsnakes/ppa && apt-get install -y python3.11 python3.11-venv python3-pip build-essential git htop gdb nano unzip curl && rm -rf /var/lib/apt/lists/*
RUN python3.11 -m pip install --upgrade setuptools virtualenv
###############################################
# Builder Image
###############################################
FROM base as builder-base
RUN python3.11 -m pip install "poetry==$POETRY_VERSION"
WORKDIR /srv
RUN git clone https://github.com/su77ungr/CASALIOY.git
WORKDIR CASALIOY
RUN python3.11 -m poetry install --with GUI,LLM --without dev --sync
RUN . .venv/bin/activate && pip install --force streamlit sentence_transformers
RUN . .venv/bin/activate && pip uninstall -y llama-cpp-python && CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install --force llama-cpp-python
###############################################
# Production Image
###############################################
FROM base as production
COPY --from=builder-base /srv /srv
WORKDIR /srv/CASALIOY
COPY example.env .env
RUN echo "source /srv/CASALIOY/.venv/bin/activate" >> ~/.bashrc
RUN . .venv/bin/activate && python -c "import nltk; nltk.download('averaged_perceptron_tagger'); nltk.download('punkt')"