-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathDockerfile
37 lines (29 loc) · 970 Bytes
/
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 python3-packaging
RUN apt install -y python3-dev
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
# Prevent Python from buffering `stdout` and `stderr`
ENV PYTHONBUFFERED 1
# Install project
COPY . .
RUN python${PY_VERSION} -m pip install -r requirements.txt
# 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"]