lavanjv commited on
Commit
c610d8c
·
1 Parent(s): 843ed88

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -4
Dockerfile CHANGED
@@ -10,16 +10,20 @@ RUN useradd -ms /bin/bash myuser
10
  # Give the user ownership of the working directory and home directory
11
  RUN chown -R myuser:myuser /app /home/myuser
12
 
13
- # Install huggingface-cli and login using the token from environment variable
14
- RUN pip install huggingface_hub
15
- ENV HUGGINGFACE_TOKEN $HUGGINGFACE_TOKEN
16
-
17
  # Switch to the non-root user
18
  USER myuser
19
 
20
  # Copy the entire contents of the local directory into the container
21
  COPY . .
22
 
 
 
 
 
 
 
 
 
23
  RUN huggingface-cli login --token $HUGGINGFACE_TOKEN
24
 
25
  # Install chainlit and add it to PATH
 
10
  # Give the user ownership of the working directory and home directory
11
  RUN chown -R myuser:myuser /app /home/myuser
12
 
 
 
 
 
13
  # Switch to the non-root user
14
  USER myuser
15
 
16
  # Copy the entire contents of the local directory into the container
17
  COPY . .
18
 
19
+ # Expose the secret HUGGINGFACE_TOKEN at buildtime and use its value as the Hugging Face token
20
+ RUN --mount=type=secret,id=HUGGINGFACE_TOKEN,mode=0444,required=true \
21
+ echo "HUGGINGFACE_TOKEN=$(cat /run/secrets/HUGGINGFACE_TOKEN)" > .env
22
+
23
+ # Install huggingface-cli
24
+ RUN pip install huggingface_hub
25
+
26
+ # Login to Hugging Face using the token from the environment variable
27
  RUN huggingface-cli login --token $HUGGINGFACE_TOKEN
28
 
29
  # Install chainlit and add it to PATH