Junaidb commited on
Commit
3a8b452
·
verified ·
1 Parent(s): be141af

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -7
Dockerfile CHANGED
@@ -1,17 +1,26 @@
1
- FROM node:20-slim
2
 
3
- RUN useradd -m -u 617250 user
4
- USER user
5
- ENV PATH="/home/user/.local/bin:$PATH"
6
 
 
7
  WORKDIR /app
8
 
 
 
9
 
10
- COPY package*.json ./
 
11
  RUN npm install
12
 
13
- COPY . .
 
 
 
 
14
 
 
 
15
  EXPOSE 7860
16
 
17
- CMD ["node", "index.js"]
 
 
 
1
 
2
+ # Use a slim version of Node.js for a smaller image size
3
+ FROM node:20-slim
 
4
 
5
+ # Set the working directory
6
  WORKDIR /app
7
 
8
+ # Create a non-root user with UID 1000 (Hugging Face requirement)
9
+ RUN useradd -m -u 1560 user
10
 
11
+ # Copy package files and install dependencies
12
+ COPY --chown=user package*.json ./
13
  RUN npm install
14
 
15
+ # Copy the rest of the application code
16
+ COPY --chown=user . .
17
+
18
+ # Switch to the non-root user
19
+ USER user
20
 
21
+ # Set environment variables (Hugging Face default port is 7860)
22
+ ENV PORT=7860
23
  EXPOSE 7860
24
 
25
+ # Start the application
26
+ CMD ["node", "index.js"]