Spaces:
Sleeping
Sleeping
Mimi
commited on
Commit
·
5aa6cc4
1
Parent(s):
1a92f96
fixed dockers
Browse files- Dockerfile +5 -10
Dockerfile
CHANGED
@@ -4,9 +4,6 @@ FROM python:3.12
|
|
4 |
# Set up a new user named "user" with user ID 1000
|
5 |
RUN useradd -m -u 1000 user
|
6 |
|
7 |
-
# Switch to the "user" user
|
8 |
-
USER user
|
9 |
-
|
10 |
# Set home to the user's home directory
|
11 |
ENV HOME=/home/user \
|
12 |
PATH=/home/user/.local/bin:$PATH
|
@@ -14,18 +11,16 @@ ENV HOME=/home/user \
|
|
14 |
# Set the working directory to the user's home directory
|
15 |
WORKDIR $HOME/app
|
16 |
|
17 |
-
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
18 |
-
RUN pip install --no-cache-dir --upgrade pip
|
19 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
20 |
-
COPY --chown=user .
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt \
|
24 |
-
chown -R user:user $HOME
|
25 |
|
26 |
-
# Hugging Face Spaces does NOT support --mount=type=secret.
|
27 |
# Instead, access HF_TOKEN via environment variables at runtime.
|
28 |
CMD huggingface-cli login --token $HF_TOKEN --add-to-git-credential && \
|
|
|
29 |
streamlit run app.py \
|
30 |
--server.headless true \
|
31 |
--server.enableCORS false \
|
|
|
4 |
# Set up a new user named "user" with user ID 1000
|
5 |
RUN useradd -m -u 1000 user
|
6 |
|
|
|
|
|
|
|
7 |
# Set home to the user's home directory
|
8 |
ENV HOME=/home/user \
|
9 |
PATH=/home/user/.local/bin:$PATH
|
|
|
11 |
# Set the working directory to the user's home directory
|
12 |
WORKDIR $HOME/app
|
13 |
|
|
|
|
|
14 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
15 |
+
COPY --chown=user . .
|
16 |
+
|
17 |
+
USER user
|
18 |
|
19 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
|
20 |
|
|
|
21 |
# Instead, access HF_TOKEN via environment variables at runtime.
|
22 |
CMD huggingface-cli login --token $HF_TOKEN --add-to-git-credential && \
|
23 |
+
chown -R user:user $HOME/.cache && \
|
24 |
streamlit run app.py \
|
25 |
--server.headless true \
|
26 |
--server.enableCORS false \
|