lucebert commited on
Commit
351a4b4
·
1 Parent(s): 7908478

update chainlit

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -13
Dockerfile CHANGED
@@ -1,19 +1,33 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.11-slim
3
 
4
- # Set the working directory in the container
5
- WORKDIR /app
 
6
 
7
- # Copy the current directory contents into the container at /app
8
- COPY . /app
 
 
9
 
10
- # Install Chainlit
11
- RUN pip install -e . && \
12
- mkdir -p /app/.files && \
13
- chmod 777 /app/.files
14
 
15
- # Make port 8000 available to the world outside this container
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  EXPOSE 7860
17
 
18
- # Run Chainlit when the container launches
19
- CMD ["chainlit", "run", "app.py", "--port", "7860", "-w", "--host", "0.0.0.0"]
 
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"]