Mimi commited on
Commit
b5e7d77
·
1 Parent(s): 06a3a1d
Files changed (1) hide show
  1. Dockerfile +9 -11
Dockerfile CHANGED
@@ -1,22 +1,20 @@
 
1
  FROM python:3.12
2
 
 
3
  WORKDIR /code
 
 
4
  COPY ./requirements.txt /code/requirements.txt
5
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
6
 
 
7
  COPY . /code/app
8
- RUN --mount=type=secret, id=HF_TOKEN \
9
- sh -c 'cat /run/secrets/HF_TOKEN > /tmp/HF_TOKEN' && \
10
- huggingface-cli login --token "$(cat /tmp/HF_TOKEN)" --add-to-git-credential
11
-
12
- RUN useradd -m -u 1000 user
13
- ENV HOME=/home/user \
14
- PATH=/home/user/.local/bin:$PATH
15
- USER user
16
- EXPOSE 7860
17
 
18
- # Login to Hugging Face at runtime & Start app
19
- CMD streamlit run app.py \
 
 
20
  --server.headless true \
21
  --server.enableCORS false \
22
  --server.enableXsrfProtection false \
 
1
+ # Use Python 3.12 as the base image
2
  FROM python:3.12
3
 
4
+ # Set working directory
5
  WORKDIR /code
6
+
7
+ # Copy requirements and install dependencies
8
  COPY ./requirements.txt /code/requirements.txt
9
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
10
 
11
+ # Copy application files
12
  COPY . /code/app
 
 
 
 
 
 
 
 
 
13
 
14
+ # Hugging Face Spaces does NOT support --mount=type=secret.
15
+ # Instead, access HF_TOKEN via environment variables at runtime.
16
+ CMD huggingface-cli login --token "$HF_TOKEN" --add-to-git-credential && \
17
+ streamlit run app.py \
18
  --server.headless true \
19
  --server.enableCORS false \
20
  --server.enableXsrfProtection false \