csalabs commited on
Commit
3b35e82
1 Parent(s): 39ecd2c

Upload Dockerfile

Browse files

Adding Docker file

Files changed (1) hide show
  1. Dockerfile +21 -0
Dockerfile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # syntax=docker/dockerfile:1
2
+ # Build as `docker build . -t localgpt`, requires BuildKit.
3
+ # Run as `docker run -it --mount src="$HOME/.cache",target=/root/.cache,type=bind --gpus=all localgpt`, requires Nvidia container toolkit.
4
+
5
+ FROM nvidia/cuda:11.7.1-runtime-ubuntu22.04
6
+ RUN apt-get update && apt-get install -y software-properties-common
7
+ RUN apt-get install -y g++-11 make python3 python-is-python3 pip
8
+ # only copy what's needed at every step to optimize layer cache
9
+ COPY ./requirements.txt .
10
+ # use BuildKit cache mount to drastically reduce redownloading from pip on repeated builds
11
+ RUN --mount=type=cache,target=/root/.cache CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install --timeout 100 -r requirements.txt
12
+ COPY SOURCE_DOCUMENTS ./SOURCE_DOCUMENTS
13
+ COPY ingest.py constants.py ./
14
+ # Docker BuildKit does not support GPU during *docker build* time right now, only during *docker run*.
15
+ # See <https://github.com/moby/buildkit/issues/1436>.
16
+ # If this changes in the future you can `docker build --build-arg device_type=cuda . -t localgpt` (+GPU argument to be determined).
17
+ ARG device_type=cpu
18
+ RUN --mount=type=cache,target=/root/.cache python ingest.py --device_type $device_type
19
+ COPY . .
20
+ ENV device_type=cuda
21
+ CMD python run_localGPT.py --device_type $device_type