Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +37 -6
Dockerfile
CHANGED
@@ -1,14 +1,45 @@
|
|
1 |
-
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
-
# you will also find guides on how best to write your Dockerfile
|
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 |
COPY . .
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
+
# # you will also find guides on how best to write your Dockerfile
|
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 |
+
# COPY . .
|
13 |
+
|
14 |
+
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
15 |
+
|
16 |
+
FROM python:3.12
|
17 |
+
### Set up user with permissions
|
18 |
+
# Set up a new user named "user" with user ID 1000
|
19 |
+
RUN useradd -m -u 1000 user
|
20 |
+
|
21 |
+
# Switch to the "user" user
|
22 |
+
USER user
|
23 |
+
|
24 |
+
# Set home to the user's home directory
|
25 |
+
ENV HOME=/home/user \
|
26 |
+
PATH=/home/user/.local/bin:$PATH
|
27 |
+
|
28 |
+
# Set the working directory to the user's home directory
|
29 |
+
WORKDIR $HOME/app
|
30 |
+
|
31 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
32 |
+
COPY --chown=user . $HOME/app
|
33 |
+
|
34 |
+
### Set up app-specific content
|
35 |
+
COPY requirements.txt requirements.txt
|
36 |
+
RUN pip3 install -r requirements.txt
|
37 |
|
38 |
COPY . .
|
39 |
|
40 |
+
### Update permissions for the app
|
41 |
+
USER root
|
42 |
+
RUN chmod 777 ~/app/*
|
43 |
+
USER user
|
44 |
+
|
45 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|