Spaces:
Sleeping
Sleeping
lucebert
commited on
Commit
·
351a4b4
1
Parent(s):
7908478
update chainlit
Browse files- Dockerfile +27 -13
Dockerfile
CHANGED
@@ -1,19 +1,33 @@
|
|
1 |
-
# Use
|
2 |
-
FROM python:3.
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
6 |
|
7 |
-
#
|
8 |
-
|
|
|
|
|
9 |
|
10 |
-
#
|
11 |
-
|
12 |
-
mkdir -p /app/.files && \
|
13 |
-
chmod 777 /app/.files
|
14 |
|
15 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
EXPOSE 7860
|
17 |
|
18 |
-
# Run
|
19 |
-
CMD ["chainlit", "run", "
|
|
|
1 |
+
# Use Python 3.10 as base image
|
2 |
+
FROM python:3.10-slim
|
3 |
|
4 |
+
# Create and set non-root user for security
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
USER user
|
7 |
|
8 |
+
# Set environment variables
|
9 |
+
ENV HOME=/home/user \
|
10 |
+
PATH=/home/user/.local/bin:$PATH \
|
11 |
+
PYTHONUNBUFFERED=1
|
12 |
|
13 |
+
# Set working directory
|
14 |
+
WORKDIR $HOME/app
|
|
|
|
|
15 |
|
16 |
+
# Copy requirements file first to leverage Docker cache
|
17 |
+
COPY --chown=user requirements.txt .
|
18 |
+
|
19 |
+
# Install dependencies
|
20 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
21 |
+
|
22 |
+
# Create and set permissions for chainlit files directory
|
23 |
+
RUN mkdir -p $HOME/app/.files && \
|
24 |
+
mkdir -p $HOME/.chainlit
|
25 |
+
|
26 |
+
# Copy the rest of the application
|
27 |
+
COPY --chown=user . .
|
28 |
+
|
29 |
+
# Expose the port
|
30 |
EXPOSE 7860
|
31 |
|
32 |
+
# Run the application
|
33 |
+
CMD ["chainlit", "run", "rag_app.py", "--host", "0.0.0.0", "--port", "7860"]
|