Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +22 -7
Dockerfile
CHANGED
@@ -1,15 +1,30 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
-
|
|
|
|
|
7 |
|
8 |
-
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
COPY . .
|
13 |
|
14 |
-
|
|
|
|
|
|
|
15 |
|
|
|
|
1 |
+
FROM python:3.12
|
2 |
+
### Set up user with permissions
|
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 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
17 |
+
COPY --chown=user . $HOME/app
|
18 |
+
|
19 |
+
### Set up app-specific content
|
20 |
+
COPY requirements.txt requirements.txt
|
21 |
+
RUN pip3 install -r requirements.txt
|
22 |
|
23 |
COPY . .
|
24 |
|
25 |
+
### Update permissions for the app
|
26 |
+
USER root
|
27 |
+
RUN chmod 777 ~/app/*
|
28 |
+
USER user
|
29 |
|
30 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|