tdeshane commited on
Commit
337bea5
1 Parent(s): ccba092

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -6
Dockerfile CHANGED
@@ -1,11 +1,25 @@
1
  FROM python:3.9
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 -r requirements.txt
10
- COPY . .
11
- CMD ["chainlit", "run", "app.py", "--port", "7860"]
 
 
 
 
 
 
1
  FROM python:3.9
2
+
3
+ # Create a user with UID 1000 and create the necessary directories with appropriate permissions
4
+ RUN useradd -m -u 1000 user && \
5
+ mkdir /home/user/app && \
6
+ chown user:user /home/user/app -R && \
7
+ chmod 755 /home/user/app -R
8
+
9
+ # Switch to the new user
10
  USER user
11
  ENV HOME=/home/user \
12
  PATH=/home/user/.local/bin:$PATH
13
+
14
+ # Set the working directory (this will automatically switch to this directory)
15
  WORKDIR $HOME/app
16
+
17
+ # Install dependencies
18
+ # Note: Copying requirements.txt separately allows Docker to cache the installed packages unless requirements.txt changes
19
+ COPY --chown=user:user requirements.txt .
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
+
22
+ # Copy the rest of your application's code
23
+ COPY --chown=user:user . .
24
+
25
+ CMD ["chainlit", "run", "app.py", "--port", "7860"]