Spaces:
Sleeping
Sleeping
Commit
·
cb89bac
1
Parent(s):
ba59ac2
Update Dockerfile
Browse files- Dockerfile +16 -12
Dockerfile
CHANGED
@@ -1,22 +1,26 @@
|
|
1 |
-
|
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 |
|
10 |
-
#
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
-
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
15 |
RUN pip install --no-cache-dir --upgrade pip
|
16 |
RUN pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
|
19 |
-
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
CMD exec gunicorn --bind :7860 --workers 1 --threads 8 --timeout 0 app:app
|
|
|
1 |
+
# For more information, please refer to https://aka.ms/vscode-docker-python
|
|
|
|
|
2 |
RUN useradd -m -u 1000 user
|
|
|
|
|
3 |
USER user
|
4 |
|
5 |
+
FROM python:3.10
|
6 |
+
|
7 |
+
# Dockerfile
|
8 |
|
9 |
+
# Copy local code to the container image.
|
10 |
+
ENV HOME=/home/user
|
11 |
+
WORKDIR $HOME/app
|
12 |
+
COPY . $HOME/app
|
13 |
|
|
|
14 |
RUN pip install --no-cache-dir --upgrade pip
|
15 |
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
17 |
+
COPY --chown=user . $HOME/app
|
18 |
+
|
19 |
|
20 |
+
# Run the web service on container startup. Here we use the gunicorn
|
21 |
+
# webserver, with one worker process and 8 threads.
|
22 |
+
# For environments with multiple CPU cores, increase the number of workers
|
23 |
+
# to be equal to the cores available.
|
24 |
+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
|
25 |
+
CMD exec gunicorn --bind :7860 --workers 1 --threads 8 --timeout 0 app:app
|
26 |
|
|