forked from CogStack/MedCATservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_gpu
50 lines (35 loc) · 1.73 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
40
41
42
43
44
45
46
47
48
49
50
FROM python:3.11-bookworm
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
RUN apt-get install apt-transport-https ca-certificates curl gnupg-agent
RUN apt-get install curl wget
RUN echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-free" | tee -a /etc/apt/sources.list
RUN echo "deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free" | tee -a /etc/apt/sources.list
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y software-properties-common
# NVIDIA Docker
RUN export distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
RUN curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey > /etc/apt/keyrings/nvidia-docker.key
RUN curl -s -L https://nvidia.github.io/nvidia-docker/debian11/nvidia-docker.list > /etc/apt/sources.list.d/nvidia-docker.list
RUN sed -i -e "s/^deb/deb \[signed-by=\/etc\/apt\/keyrings\/nvidia-docker.key\]/g" /etc/apt/sources.list.d/nvidia-docker.list
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y nvidia-container-toolkit nvidia-docker2
# clean up apt
RUN apt-get clean autoclean && apt-get autoremove --purge -y
# Set the python path and preapre the base layer
WORKDIR /cat
COPY ./medcat_service/requirements.txt /cat
RUN pip install --upgrade pip
# clean up pip
RUN pip3 cache purge
# Install requirements for the app
RUN pip install --no-cache-dir -r requirements.txt
# Get the spacy model
ARG SPACY_MODELS="en_core_web_sm en_core_web_md en_core_web_lg"
RUN for spacy_model in ${SPACY_MODELS}; do python -m spacy download $spacy_model; done
# Copy the remaining files
COPY . /cat
# Now run the simple api
CMD ["/bin/bash", "start-service-prod.sh"]