boldhasnain commited on
Commit
4bb99a7
·
verified ·
1 Parent(s): 117ecd8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -51
Dockerfile CHANGED
@@ -1,51 +1,30 @@
1
- # Use Ubuntu 18.04 as the base image
2
- FROM ubuntu:18.04
3
-
4
- # Set environment variables for locale
5
- ENV LANG=C.UTF-8
6
- ENV LC_ALL=C.UTF-8
7
-
8
- # Install system dependencies and add Python 3.10 repository
9
- RUN apt-get update && \
10
- apt-get install -y \
11
- software-properties-common && \
12
- add-apt-repository ppa:deadsnakes/ppa && \
13
- apt-get update && \
14
- apt-get install -y \
15
- python3.10 \
16
- python3.10-distutils \
17
- python3-pip \
18
- build-essential \
19
- libblas-dev \
20
- liblapack-dev \
21
- libbz2-dev \
22
- zlib1g-dev \
23
- liblzma-dev \
24
- libsnappy-dev && \
25
- rm -rf /var/lib/apt/lists/*
26
-
27
- # Upgrade pip
28
- RUN python3.10 -m pip install --upgrade pip
29
-
30
- # Install Python packages
31
- RUN python3.10 -m pip install \
32
- streamlit \
33
- google-generativeai \
34
- langchain \
35
- PyPDF2 \
36
- chromadb \
37
- faiss-cpu \
38
- pdf2image
39
-
40
- # Copy application files
41
- COPY sql.py /app/sql.py
42
- COPY sqlite.py /app/sqlite.py
43
-
44
- # Set the working directory
45
- WORKDIR /app
46
-
47
- # Set Python 3.10 as the default Python
48
- RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
49
-
50
- # Start the application
51
- CMD ["streamlit", "run", "sql.py"]
 
1
+ # Use Python 3.10 base image
2
+ FROM python:3.10
3
+
4
+ # Set the working directory to /code
5
+ WORKDIR /code
6
+
7
+ # Copy the requirements file
8
+ COPY ./requirements.txt /code/requirements.txt
9
+
10
+ # Install the requirements
11
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
+
13
+ # Set up a new user named "user"
14
+ RUN useradd -m -d /home/user user
15
+
16
+ # Switch to the "user" user
17
+ USER user
18
+
19
+ # Set environment variables
20
+ ENV HOME=/home/user \
21
+ PATH=/home/user/.local/bin:$PATH
22
+
23
+ # Set the working directory to the user's home directory
24
+ WORKDIR $HOME/app
25
+
26
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
27
+ COPY --chown=user . $HOME/app
28
+
29
+ # Start the Streamlit App
30
+ CMD ["streamlit", "run", "sql.py"]