Spaces:
No application file
No application file
Update dockerfile
Browse files- dockerfile +30 -0
dockerfile
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#use the officialy python image
|
| 2 |
+
from python:3.9
|
| 3 |
+
|
| 4 |
+
##set the working dir code
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
|
| 7 |
+
##copy the current dir code
|
| 8 |
+
copy ./requirements.txt/code/requirements.txt
|
| 9 |
+
|
| 10 |
+
##install the requirement.txt
|
| 11 |
+
RUN pip install --no-cache-dir --upgrade -r code/requirements.txt
|
| 12 |
+
|
| 13 |
+
#set the new user name
|
| 14 |
+
RUN useradd user
|
| 15 |
+
|
| 16 |
+
##switch the user
|
| 17 |
+
USER user
|
| 18 |
+
|
| 19 |
+
##set home to user dir
|
| 20 |
+
ENV home = /home/user \
|
| 21 |
+
path = /home/user/.local/bin:$PATH
|
| 22 |
+
|
| 23 |
+
#set the working dir
|
| 24 |
+
WORKDIR $HOME/app
|
| 25 |
+
|
| 26 |
+
##copy current dir
|
| 27 |
+
copy --chown=user . $HOME/app
|
| 28 |
+
|
| 29 |
+
##start the app port
|
| 30 |
+
CMD ["uvicorn","app:app","--host","0.0.0.0","--port","7860"]
|