Update Dockerfile
Browse files- Dockerfile +68 -26
Dockerfile
CHANGED
@@ -1,48 +1,90 @@
|
|
1 |
-
# Use a Python base image
|
2 |
-
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04
|
3 |
|
4 |
-
# Set the working directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
WORKDIR /DocQA
|
6 |
-
|
|
|
7 |
RUN apt-get update && apt-get install -y \
|
8 |
git \
|
9 |
python3.10 \
|
10 |
python3-pip \
|
11 |
-
|
|
|
12 |
|
13 |
|
14 |
-
RUN apt-get install poppler-utils -y
|
15 |
|
16 |
|
17 |
-
|
18 |
RUN useradd -m -u 1000 user
|
19 |
|
|
|
20 |
USER user
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
PATH=/home/user/.local/bin:$PATH
|
24 |
-
|
25 |
WORKDIR $HOME/app
|
26 |
-
# Copy the requirements.txt file
|
27 |
-
COPY --chown=user requirements.txt $HOME/app
|
28 |
|
29 |
-
|
|
|
|
|
|
|
30 |
|
31 |
-
# Copy the rest of the application
|
32 |
-
COPY --chown=user
|
33 |
-
COPY --chown=user app.py $HOME/app
|
34 |
-
COPY --chown=user ./classification.py $HOME/app
|
35 |
-
COPY --chown=user donut_inference.py $HOME/app
|
36 |
-
COPY --chown=user non_form_llama_parse.py $HOME/app
|
37 |
-
COPY --chown=user RAG.py $HOME/app
|
38 |
-
COPY --chown=user best_resnet152_model.h5 $HOME/app
|
39 |
-
COPY --chown=user Model $HOME/app
|
40 |
|
41 |
# Expose the port the app runs on
|
42 |
-
# EXPOSE 7860
|
43 |
EXPOSE 8501
|
44 |
|
|
|
|
|
45 |
|
46 |
-
# Start the application
|
47 |
-
# CMD ["streamlit", "run", "app.py"]
|
48 |
-
ENTRYPOINT ["streamlit", "run","app.py" ,"--server.enableXsrfProtection", "false"]
|
|
|
1 |
+
# # Use a Python base image
|
2 |
+
# FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04
|
3 |
|
4 |
+
# # Set the working directory
|
5 |
+
# WORKDIR /DocQA
|
6 |
+
# # Install dependencies
|
7 |
+
# RUN apt-get update && apt-get install -y \
|
8 |
+
# git \
|
9 |
+
# python3.10 \
|
10 |
+
# python3-pip \
|
11 |
+
# && apt-get clean
|
12 |
+
|
13 |
+
|
14 |
+
# RUN apt-get install poppler-utils -y
|
15 |
+
|
16 |
+
|
17 |
+
# RUN pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
|
18 |
+
# RUN useradd -m -u 1000 user
|
19 |
+
|
20 |
+
# USER user
|
21 |
+
|
22 |
+
# ENV HOME=/home/user \
|
23 |
+
# PATH=/home/user/.local/bin:$PATH
|
24 |
+
|
25 |
+
# WORKDIR $HOME/app
|
26 |
+
# # Copy the requirements.txt file
|
27 |
+
# COPY --chown=user requirements.txt $HOME/app
|
28 |
+
|
29 |
+
# RUN pip install --no-cache-dir -r requirements.txt
|
30 |
+
|
31 |
+
# # Copy the rest of the application codeDocQA
|
32 |
+
# COPY --chown=user images $HOME/app
|
33 |
+
# COPY --chown=user app.py $HOME/app
|
34 |
+
# COPY --chown=user ./classification.py $HOME/app
|
35 |
+
# COPY --chown=user donut_inference.py $HOME/app
|
36 |
+
# COPY --chown=user non_form_llama_parse.py $HOME/app
|
37 |
+
# COPY --chown=user RAG.py $HOME/app
|
38 |
+
# COPY --chown=user best_resnet152_model.h5 $HOME/app
|
39 |
+
# COPY --chown=user Model $HOME/app
|
40 |
+
|
41 |
+
# # Expose the port the app runs on
|
42 |
+
# # EXPOSE 7860
|
43 |
+
# EXPOSE 8501
|
44 |
+
|
45 |
+
|
46 |
+
# # Start the application
|
47 |
+
# # CMD ["streamlit", "run", "app.py"]
|
48 |
+
# ENTRYPOINT ["streamlit", "run","app.py" ,"--server.enableXsrfProtection", "false"]
|
49 |
+
# Use a base image from NVIDIA that includes CUDA and cuDNN
|
50 |
+
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04
|
51 |
+
|
52 |
+
# Set the working directory in the container
|
53 |
WORKDIR /DocQA
|
54 |
+
|
55 |
+
# Install system dependencies, including Python and utilities
|
56 |
RUN apt-get update && apt-get install -y \
|
57 |
git \
|
58 |
python3.10 \
|
59 |
python3-pip \
|
60 |
+
poppler-utils \
|
61 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
62 |
|
63 |
|
|
|
64 |
|
65 |
|
66 |
+
# Add a new user to avoid running as root
|
67 |
RUN useradd -m -u 1000 user
|
68 |
|
69 |
+
# Switch to the new user
|
70 |
USER user
|
71 |
+
ENV HOME=/home/user
|
72 |
+
ENV PATH=/home/user/.local/bin:$PATH
|
73 |
|
74 |
+
# Set the working directory for the application
|
|
|
|
|
75 |
WORKDIR $HOME/app
|
|
|
|
|
76 |
|
77 |
+
# Copy the requirements.txt first to leverage Docker cache
|
78 |
+
COPY --chown=user requirements.txt $HOME/app/
|
79 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
80 |
+
RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
|
81 |
|
82 |
+
# Copy the rest of the application's code to the container
|
83 |
+
COPY --chown=user . $HOME/app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
# Expose the port the app runs on
|
|
|
86 |
EXPOSE 8501
|
87 |
|
88 |
+
# Set the entry point to run the application
|
89 |
+
ENTRYPOINT ["streamlit", "run", "app.py", "--server.enableXsrfProtection", "false"]
|
90 |
|
|
|
|
|
|