- Dockerfile +10 -19
Dockerfile
CHANGED
@@ -3,30 +3,21 @@
|
|
3 |
|
4 |
FROM python:3.9
|
5 |
|
6 |
-
### Set up user with permissions
|
7 |
-
# Set up a new user named "user" with user ID 1000
|
8 |
-
RUN useradd -m -u 1000 user
|
9 |
-
|
10 |
-
# Switch to the "user" user
|
11 |
-
USER user
|
12 |
-
|
13 |
-
RUN mkdir /code
|
14 |
-
RUN chmod 777 /code
|
15 |
-
|
16 |
WORKDIR /code
|
17 |
|
18 |
COPY ./requirements.txt /code/requirements.txt
|
19 |
|
20 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
### Update permissions for the app
|
26 |
-
# USER root
|
27 |
-
# RUN chmod 777 $PWD
|
28 |
-
# RUN chmod 777 /
|
29 |
-
# USER user
|
30 |
|
31 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
32 |
-
# CMD [ "python", "app.py" ]
|
|
|
3 |
|
4 |
FROM python:3.9
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
WORKDIR /code
|
7 |
|
8 |
COPY ./requirements.txt /code/requirements.txt
|
9 |
|
10 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
11 |
|
12 |
+
RUN useradd -m -u 1000 user
|
13 |
+
|
14 |
+
USER user
|
15 |
+
|
16 |
+
ENV HOME=/home/user \
|
17 |
+
PATH=/home/user/.local/bin:$PATH
|
18 |
+
|
19 |
+
WORKDIR $HOME/app
|
20 |
|
21 |
+
COPY --chown=user . $HOME/app
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|