File size: 588 Bytes
1291df8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#use the officialy python image
from python:3.9

##set the working dir code
WORKDIR /code

##copy the current dir code
copy ./requirements.txt/code/requirements.txt

##install the requirement.txt
RUN pip install --no-cache-dir --upgrade -r code/requirements.txt

#set the new user name
RUN useradd user

##switch the user
USER user

##set home to user dir
ENV home = /home/user \
path = /home/user/.local/bin:$PATH

#set the working dir
WORKDIR $HOME/app

##copy current dir
copy --chown=user . $HOME/app

##start the app port
CMD ["uvicorn","app:app","--host","0.0.0.0","--port","7860"]