hansaka01 commited on
Commit
2fd5e3a
·
verified ·
1 Parent(s): 96f023b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -9
Dockerfile CHANGED
@@ -1,24 +1,21 @@
1
  # Step 1: Use an official Node.js runtime as the base image
2
  FROM node:20-slim
3
 
4
- # Install git so we can clone the private/public repo
5
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
6
 
7
  # Set the working directory inside the container
8
  WORKDIR /app
9
 
10
- # Declare the build argument for your Hugging Face Secret
11
- # (Make sure the Secret name in HF matches 'GIT_REPO_URL')
12
- ARG GIT_REPO_URL
13
-
14
- # Clone the repository into the current directory (.)
15
- # Using a shallow clone (--depth 1) keeps the image size smaller
16
- RUN git clone ${GIT_REPO_URL} .
17
 
18
  # Install project dependencies
19
  RUN npm ci --only=production
20
 
21
- # Expose the port your app runs on (Hugging Face usually expects 7860)
22
  EXPOSE 7860
23
  ENV PORT=7860
24
 
 
1
  # Step 1: Use an official Node.js runtime as the base image
2
  FROM node:20-slim
3
 
4
+ # Install git so we can clone the repo
5
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
6
 
7
  # Set the working directory inside the container
8
  WORKDIR /app
9
 
10
+ # --- THE FIX IS HERE ---
11
+ # Mount the Hugging Face secret safely during the build layer
12
+ RUN --mount=type=secret,id=GIT_REPO_URL,mode=0444,required=true \
13
+ git clone $(cat /run/secrets/GIT_REPO_URL) .
 
 
 
14
 
15
  # Install project dependencies
16
  RUN npm ci --only=production
17
 
18
+ # Expose the port your app runs on
19
  EXPOSE 7860
20
  ENV PORT=7860
21