adyaprasad commited on
Commit
84be062
·
verified ·
1 Parent(s): 8a82696

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -29
Dockerfile CHANGED
@@ -1,29 +1,29 @@
1
- # Use the official Python 3.8 image
2
- FROM python:3.9
3
-
4
- # set the working directory to /code
5
- WORKDIR /code
6
-
7
- # copy the current directory contents in the container /code
8
-
9
- COPY ./requirements.txt /code/requirements.txt
10
-
11
- # install the requirements.txt with parameter np cache
12
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
13
-
14
- #Switching up a new user: 'user'
15
- USER user
16
-
17
- # set home to the user's home directory
18
-
19
- ENV HOME=/home/user \
20
- PATH=/home/user/.local/bin/:$PATH
21
-
22
- # set working directory to the user's home directory
23
- WORKDIR $HOME/app
24
-
25
- # copy the current directory contents into the container at $HOME/app setting the owner to the user
26
- COPY --chown=user . $HOME/app
27
-
28
- # start the FastAPI App on port 7860
29
- CMD [ "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860" ]
 
1
+ # Use the official Python 3.9 image
2
+ FROM python:3.9
3
+
4
+ # Set the working directory to /code
5
+ WORKDIR /code
6
+
7
+ # Copy requirements.txt into the container
8
+ COPY ./requirements.txt /code/requirements.txt
9
+
10
+ # Install dependencies
11
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
+
13
+ # Switch to a new user: 'user'
14
+ RUN useradd -m user
15
+ USER user
16
+
17
+ # Set home and cache directories for the 'user'
18
+ ENV HOME=/home/user \
19
+ PATH=/home/user/.local/bin/:$PATH \
20
+ TRANSFORMERS_CACHE=/home/user/.cache/huggingface
21
+
22
+ # Set working directory to the user's home directory
23
+ WORKDIR $HOME/app
24
+
25
+ # Copy current directory into the container and set ownership to 'user'
26
+ COPY --chown=user . $HOME/app
27
+
28
+ # Start the FastAPI app
29
+ CMD [ "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860" ]