anmolmore commited on
Commit
176f684
·
verified ·
1 Parent(s): 30864aa

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -2
Dockerfile CHANGED
@@ -2,5 +2,20 @@ FROM python:3.10
2
  WORKDIR /code
3
  COPY ./requirements.txt /code/requirements.txt
4
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
5
- COPY . .
6
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  WORKDIR /code
3
  COPY ./requirements.txt /code/requirements.txt
4
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
5
+
6
+ # Set up a new user named "user" with user ID 1000
7
+ RUN useradd -m -u 1000 user
8
+ # Switch to the "user" user
9
+ USER user
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/app
16
+
17
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
18
+ COPY --chown=user . $HOME/app
19
+
20
+ # Start the FastAPI app on port 7860, the default port expected by Spaces
21
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]