GuysRGithub
commited on
Commit
•
5496ffc
1
Parent(s):
6cef789
Fix
Browse files- Dockerfile +18 -4
Dockerfile
CHANGED
@@ -1,11 +1,25 @@
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
-
|
|
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
|
|
|
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
+
# Set up a new user named "user" with user ID 1000
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
|
6 |
+
# Switch to the "user" user
|
7 |
+
USER user
|
8 |
|
9 |
+
# Set home to the user's home directory
|
10 |
+
ENV HOME=/home/user \
|
11 |
+
PATH=/home/user/.local/bin:$PATH
|
12 |
|
13 |
+
# Set the working directory to the user's home directory
|
14 |
+
WORKDIR $HOME/app
|
15 |
+
|
16 |
+
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
17 |
+
RUN pip install --no-cache-dir --upgrade pip
|
18 |
+
|
19 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
20 |
+
COPY --chown=user . $HOME/app
|
21 |
+
|
22 |
+
# Download a checkpoint
|
23 |
+
RUN pip install --no-cache-dir --upgrade -r $HOME/app/requirements.txt
|
24 |
|
25 |
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "7860"]
|