BMCVRN commited on
Commit
3b899cd
·
verified ·
1 Parent(s): 26d2acb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -4
Dockerfile CHANGED
@@ -1,6 +1,19 @@
1
  # Use the official Python 3.10.9 image
2
  FROM python:3.10.9
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  # Expose the port FastAPI will run on
5
  EXPOSE 7860
6
 
@@ -15,14 +28,14 @@ ENV OPENAI_GENERAL_ASSISTANT=$OPENAI_GENERAL_ASSISTANT
15
  ENV PYTHONUNBUFFERED=1
16
 
17
  # Set the working directory
18
- WORKDIR /code
19
 
20
  # Copy requirements and install dependencies
21
- COPY ./app/requirements.txt /code/requirements.txt
22
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
23
 
24
  # Copy the app directory
25
- COPY ./app /code/app
26
 
27
  # Start the FastAPI app on port 7860
28
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "900"]
 
1
  # Use the official Python 3.10.9 image
2
  FROM python:3.10.9
3
 
4
+ # Set up a new user named "user" with user ID 1000
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Switch to the "user" user
8
+ USER user
9
+
10
+ # Set home to the user's home directory
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ # Set the working directory to the user's home directory
15
+ WORKDIR $HOME/code
16
+
17
  # Expose the port FastAPI will run on
18
  EXPOSE 7860
19
 
 
28
  ENV PYTHONUNBUFFERED=1
29
 
30
  # Set the working directory
31
+ # WORKDIR /code
32
 
33
  # Copy requirements and install dependencies
34
+ COPY ./app/requirements.txt $HOME/code/requirements.txt
35
+ RUN pip install --no-cache-dir --upgrade -r $HOME/code/requirements.txt
36
 
37
  # Copy the app directory
38
+ COPY ./app $HOME/code/app
39
 
40
  # Start the FastAPI app on port 7860
41
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "900"]