Spaces:
Sleeping
Sleeping
Updated Dockerfile
Browse files- Dockerfile +11 -16
Dockerfile
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
-
FROM python:3.12
|
2 |
|
3 |
# Create a non-root user
|
4 |
RUN useradd -m -u 1000 user
|
5 |
|
|
|
6 |
USER user
|
7 |
|
8 |
# Set environment variables
|
@@ -12,28 +13,22 @@ ENV HOME=/home/user \
|
|
12 |
# Set the working directory
|
13 |
WORKDIR $HOME/app
|
14 |
|
15 |
-
# Copy files and install dependencies
|
16 |
COPY --chown=user . $HOME/app
|
17 |
-
COPY ./requirements.txt
|
18 |
-
|
19 |
-
# Install dependencies
|
20 |
RUN pip install --upgrade pip
|
21 |
RUN pip install -r requirements.txt
|
22 |
-
|
23 |
-
# List installed packages for debugging
|
24 |
RUN pip list
|
25 |
|
26 |
-
#
|
27 |
USER root
|
28 |
RUN mkdir -p /home/user/app/data/vectorstore && \
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
# Ensure translation directory and default files exist
|
33 |
-
RUN mkdir -p /home/user/app/.chainlit/translations && \
|
34 |
-
echo '{}' > /home/user/app/.chainlit/translations/en-US.json
|
35 |
|
|
|
36 |
USER user
|
37 |
|
38 |
-
#
|
39 |
-
CMD ["
|
|
|
1 |
+
FROM python:3.12
|
2 |
|
3 |
# Create a non-root user
|
4 |
RUN useradd -m -u 1000 user
|
5 |
|
6 |
+
# Switch to the non-root user
|
7 |
USER user
|
8 |
|
9 |
# Set environment variables
|
|
|
13 |
# Set the working directory
|
14 |
WORKDIR $HOME/app
|
15 |
|
16 |
+
# Copy application files and install dependencies
|
17 |
COPY --chown=user . $HOME/app
|
18 |
+
COPY ./requirements.txt $HOME/app/requirements.txt
|
|
|
|
|
19 |
RUN pip install --upgrade pip
|
20 |
RUN pip install -r requirements.txt
|
|
|
|
|
21 |
RUN pip list
|
22 |
|
23 |
+
# Create the necessary directories and set permissions
|
24 |
USER root
|
25 |
RUN mkdir -p /home/user/app/data/vectorstore && \
|
26 |
+
mkdir -p /home/user/app/.chainlit && \
|
27 |
+
chown -R user:user /home/user/app/data /home/user/app/.chainlit && \
|
28 |
+
chmod -R 777 /home/user/app/data /home/user/app/.chainlit
|
|
|
|
|
|
|
29 |
|
30 |
+
# Switch back to the non-root user
|
31 |
USER user
|
32 |
|
33 |
+
# Start the application
|
34 |
+
CMD ["chainlit", "run", "app.py", "--port", "7860"]
|