-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile
37 lines (29 loc) · 1.01 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
FROM nvidia/cuda:11.7.1-devel-ubuntu20.04
# Update, install
ENV PY_VERSION='3.9'
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
RUN apt update
RUN apt install -y build-essential python${PY_VERSION} git
RUN apt install -y python3-pip python3-distutils
RUN python${PY_VERSION} -m pip install --upgrade pip setuptools wheel
# Create user instead of using root
ENV USER='user'
RUN groupadd -r user && useradd -r -g $USER $USER
USER $USER
# Define workdir
WORKDIR /home/$USER/app
# Install project
COPY . .
RUN python${PY_VERSION} -m pip install -r requirements.txt
# Fix: OSError (non writable)
RUN mkdir -p /home/$USER/.cache/huggingface/hub/models--tloen--alpaca-lora-7b
RUN chmod a+rwx -R /home/$USER/.cache/huggingface/hub/models--tloen--alpaca-lora-7b
# Get model weights and tokenizer
RUN python${PY_VERSION} get_models.py
# Publish port
EXPOSE 50051:50051
# Enjoy
ENTRYPOINT python${PY_VERSION} server.py
CMD ["--address", "[::]:50051"]