Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +30 -51
Dockerfile
CHANGED
|
@@ -1,51 +1,30 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM
|
| 3 |
-
|
| 4 |
-
# Set
|
| 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 |
-
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"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|