norjala commited on
Commit
59acd88
1 Parent(s): 2c25ac8

Updated Dockerfile

Browse files
Files changed (1) hide show
  1. 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 ./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
- # Ensure the data directory exists with correct permissions
27
  USER root
28
  RUN mkdir -p /home/user/app/data/vectorstore && \
29
- chown -R user:user /home/user/app/data && \
30
- chmod -R 777 /home/user/app/data
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
- # Run the Chainlit application with Gunicorn and Uvicorn
39
- CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "app:app", "--bind", "0.0.0.0:7860"]
 
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"]