forked from NVIDIA/GenerativeAIExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (44 loc) · 2.08 KB
/
Dockerfile
File metadata and controls
55 lines (44 loc) · 2.08 KB
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
51
52
53
54
55
ARG BASE_IMAGE_URL=nvcr.io/nvidia/base/ubuntu
ARG BASE_IMAGE_TAG=22.04_20240212
FROM ${BASE_IMAGE_URL}:${BASE_IMAGE_TAG}
ENV PYTHONDONTWRITEBYTECODE=1
ENV DEBIAN_FRONTEND noninteractive
# Install required ubuntu packages for setting up python 3.10
RUN apt update && \
apt install -y curl software-properties-common libgl1 libglib2.0-0 && \
add-apt-repository ppa:deadsnakes/ppa && \
apt update && apt install -y python3.10 python3.10-dev python3.10-distutils && \
apt-get clean
# Install pip for python3.10
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
RUN rm -rf /var/lib/apt/lists/*
# Uninstall build packages
RUN apt autoremove -y curl software-properties-common
# Install common dependencies for all examples
RUN --mount=type=bind,source=RetrievalAugmentedGeneration/requirements.txt,target=/opt/requirements.txt \
pip3 install --no-cache-dir -r /opt/requirements.txt
# Install any example specific dependency if available
ARG EXAMPLE_NAME
COPY RetrievalAugmentedGeneration/examples/${EXAMPLE_NAME} /opt/RetrievalAugmentedGeneration/example
RUN if [ -f "/opt/RetrievalAugmentedGeneration/example/requirements.txt" ] ; then \
pip3 install --no-cache-dir -r /opt/RetrievalAugmentedGeneration/example/requirements.txt ; else \
echo "Skipping example dependency installation, since requirements.txt was not found" ; \
fi
RUN python3.10 -m nltk.downloader averaged_perceptron_tagger
RUN if [ "${EXAMPLE_NAME}" = "multimodal_rag" ] ; then \
apt update && \
apt install -y libreoffice && \
apt install -y tesseract-ocr ; \
fi
# Copy required common modules for all examples
COPY RetrievalAugmentedGeneration/__init__.py /opt/RetrievalAugmentedGeneration/
COPY RetrievalAugmentedGeneration/common /opt/RetrievalAugmentedGeneration/common
COPY integrations /opt/integrations
COPY tools /opt/tools
RUN mkdir /tmp-data/; mkdir /tmp-data/nltk_data/
RUN chmod 777 -R /tmp-data
RUN chown 1000:1000 -R /tmp-data
ENV NLTK_DATA=/tmp-data/nltk_data/
ENV HF_HOME=/tmp-data
WORKDIR /opt
ENTRYPOINT ["uvicorn", "RetrievalAugmentedGeneration.common.server:app"]