hansaka01 commited on
Commit
39203fb
·
verified ·
1 Parent(s): a3eebd1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -17
Dockerfile CHANGED
@@ -1,24 +1,24 @@
1
- # Use official Node.js image (using version 18-slim for a small footprint)
2
- FROM node:18-slim
3
 
4
- # Set working directory
5
- WORKDIR /app
6
 
7
- # Copy package files first
8
- # This is equivalent to copying requirements.txt.
9
- # We do this first so Docker caches the "npm install" step if dependencies haven't changed.
10
- COPY package*.json ./
11
 
12
- # Install dependencies
13
- RUN npm install --production
 
 
14
 
15
- # Copy the app folder
16
- # This copies your 'app' folder from your computer to '/app/app' in the container
17
- COPY app/ ./app/
18
 
19
- # Expose port (Hugging Face default)
20
  EXPOSE 7860
 
21
 
22
- # Run the application
23
- # We use the full path to the file. Assuming your main file is named 'index.js'
24
- CMD ["node", "app/index.js"]
 
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
+ # Replace the old npm ci line with this:
17
+ RUN npm install --omit=dev
18
 
19
+ # Expose the port your app runs on
20
  EXPOSE 7860
21
+ ENV PORT=7860
22
 
23
+ # Start the application
24
+ CMD ["npm", "start"]