eaedk commited on
Commit
3ac8ad8
1 Parent(s): 3f58799
Files changed (1) hide show
  1. Dockerfile +25 -32
Dockerfile CHANGED
@@ -1,35 +1,28 @@
1
  FROM python:3.9
2
- # # Set up a new user named "user" with user ID 1000
3
- # RUN useradd -m -u 1000 user
4
-
5
- # # Switch to the "user" user
6
- # USER user
7
-
8
- # # Set home to the user's home directory
9
- # ENV HOME=/home/user \
10
- # PATH=/home/user/.local/bin:$PATH
11
-
12
- # # Set the working directory to the user's home directory
13
- # WORKDIR $HOME/app
14
-
15
- # # Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
16
- # RUN pip install --no-cache-dir --upgrade pip
17
-
18
- # # Copy the current directory contents into the container at $HOME/app setting the owner to the user
19
- # COPY --chown=user . $HOME/app
20
-
21
- # # Download a checkpoint
22
- # RUN mkdir content
23
- # ADD --chown=user https://<SOME_ASSET_URL> content/<SOME_ASSET_NAME>
24
-
25
- WORKDIR /app
26
-
27
- COPY requirements.txt /app/
28
-
29
- RUN pip install -r /app/requirements.txt
30
-
31
- EXPOSE 7860
32
-
33
- COPY . /app/
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  CMD ["uvicorn", "src.main_sentiment:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ # Set the working directory to /code
4
+ WORKDIR /code
5
+
6
+ # Copy the current directory contents into the container at /code
7
+ COPY ./requirements.txt /code/requirements.txt
8
+
9
+ # Install requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
+
12
+ # Set up a new user named "user" with user ID 1000
13
+ RUN useradd -m -u 1000 user
14
+ # Switch to the "user" user
15
+ USER user
16
+ # Set home to the user's home directory
17
+ ENV HOME=/home/user \
18
+ PATH=/home/user/.local/bin:$PATH
19
+
20
+ # Set the working directory to the user's home directory
21
+ WORKDIR $HOME/app
22
+
23
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
24
+ COPY --chown=user . $HOME/app
25
+
26
+ # Start the FastAPI app on port 7860, the default port expected by Spaces
27
+ # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
28
  CMD ["uvicorn", "src.main_sentiment:app", "--host", "0.0.0.0", "--port", "7860"]