norjala commited on
Commit
b366622
1 Parent(s): 9f3be8d

Updated Dockerfile, requirements, and application code

Browse files
Files changed (2) hide show
  1. Dockerfile +22 -3
  2. requirements.txt +4 -1
Dockerfile CHANGED
@@ -1,20 +1,39 @@
1
  FROM python:3.12
 
 
2
  RUN useradd -m -u 1000 user
 
3
  USER user
 
 
4
  ENV HOME=/home/user \
5
  PATH=/home/user/.local/bin:$PATH
 
 
6
  WORKDIR $HOME/app
 
 
7
  COPY --chown=user . $HOME/app
8
- COPY ./requirements.txt ~/app/requirements.txt
 
 
9
  RUN pip install --upgrade pip
10
  RUN pip install -r requirements.txt
 
 
11
  RUN pip list
12
 
13
- # Create the directory and set permissions
14
  USER root
15
  RUN mkdir -p /home/user/app/data/vectorstore && \
16
  chown -R user:user /home/user/app/data && \
17
  chmod -R 777 /home/user/app/data
 
 
 
 
 
18
  USER user
19
 
20
- CMD ["chainlit", "run", "app.py", "--port", "7860"]
 
 
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
9
  ENV HOME=/home/user \
10
  PATH=/home/user/.local/bin:$PATH
11
+
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"]
requirements.txt CHANGED
@@ -8,4 +8,7 @@ langchain_openai==0.1.9
8
  python-dotenv==1.0.0
9
  pymupdf==1.24.5
10
  faiss-cpu==1.8.0.post1
11
- openai==1.35.3
 
 
 
 
8
  python-dotenv==1.0.0
9
  pymupdf==1.24.5
10
  faiss-cpu==1.8.0.post1
11
+ openai==1.35.3
12
+ tiktoken==0.2.0
13
+ uvicorn==0.18.2
14
+ gunicorn==20.1.0