Spaces:
Running
Running
更新 Dockerfile,优化 pip 安装命令,调整 HF_Token 输出路径,并恢复 git clone 命令
Browse files- Dockerfile +11 -10
Dockerfile
CHANGED
@@ -8,33 +8,34 @@ WORKDIR /app
|
|
8 |
COPY . /app
|
9 |
|
10 |
# 安装所需的 Python 包
|
11 |
-
RUN pip install -r requirements.txt
|
|
|
12 |
|
13 |
# 公开 Gradio 默认的端口 7860
|
14 |
EXPOSE 7860
|
15 |
|
16 |
# Set up a new user named "user" with user ID 1000
|
17 |
-
RUN useradd -m -u 1000 user
|
18 |
# Switch to the "user" user
|
19 |
-
USER user
|
20 |
# Set home to the user's home directory
|
21 |
-
ENV HOME=/home/user \
|
22 |
-
PATH=/home/user/.local/bin:$PATH
|
23 |
|
24 |
# Set the working directory to the user's home directory
|
25 |
-
WORKDIR $HOME/app
|
26 |
|
27 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
28 |
-
COPY --chown=user . $HOME/app
|
29 |
|
30 |
|
31 |
# Get secret EXAMPLE and output it to /test at buildtime
|
32 |
RUN --mount=type=secret,id=HF_Token,mode=0444,required=true \
|
33 |
-
|
34 |
|
35 |
# Get secret SECRET_EXAMPLE and clone it as repo at buildtime
|
36 |
-
|
37 |
-
|
38 |
|
39 |
|
40 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
8 |
COPY . /app
|
9 |
|
10 |
# 安装所需的 Python 包
|
11 |
+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
12 |
+
|
13 |
|
14 |
# 公开 Gradio 默认的端口 7860
|
15 |
EXPOSE 7860
|
16 |
|
17 |
# Set up a new user named "user" with user ID 1000
|
18 |
+
#RUN useradd -m -u 1000 user
|
19 |
# Switch to the "user" user
|
20 |
+
#USER user
|
21 |
# Set home to the user's home directory
|
22 |
+
#ENV HOME=/home/user \
|
23 |
+
# PATH=/home/user/.local/bin:$PATH
|
24 |
|
25 |
# Set the working directory to the user's home directory
|
26 |
+
#WORKDIR $HOME/app
|
27 |
|
28 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
29 |
+
#COPY --chown=user . $HOME/app
|
30 |
|
31 |
|
32 |
# Get secret EXAMPLE and output it to /test at buildtime
|
33 |
RUN --mount=type=secret,id=HF_Token,mode=0444,required=true \
|
34 |
+
cat /run/secrets/HF_Token > /HF_Token
|
35 |
|
36 |
# Get secret SECRET_EXAMPLE and clone it as repo at buildtime
|
37 |
+
RUN --mount=type=secret,id=HF_Token,mode=0444,required=true \
|
38 |
+
git clone $(cat /run/secrets/HF_Token)
|
39 |
|
40 |
|
41 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|