API-Handler commited on
Commit
d5d7d6c
·
verified ·
1 Parent(s): 567f740

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -20
Dockerfile CHANGED
@@ -1,20 +1,27 @@
1
- # Use Node.js LTS version
2
- FROM node:18-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Copy package files
8
- COPY package*.json ./
9
-
10
- # Install dependencies
11
- RUN npm install
12
-
13
- # Copy application files
14
- COPY . .
15
-
16
- # Expose port
17
- EXPOSE 7860
18
-
19
- # Start the application
20
- CMD ["npm", "start"]
 
 
 
 
 
 
 
 
1
+ # Use Node.js LTS version
2
+ FROM node:18-slim
3
+
4
+ # Switch to the "node" user for security
5
+ USER node
6
+
7
+ # Set home to the user's home directory and add local bin to PATH
8
+ ENV HOME=/home/node \
9
+ PATH=/home/node/.local/bin:$PATH
10
+
11
+ # Set the working directory to the user's home directory
12
+ WORKDIR $HOME/app
13
+
14
+ # Copy package files with correct ownership
15
+ COPY --chown=node:node package*.json ./
16
+
17
+ # Install dependencies
18
+ RUN npm install
19
+
20
+ # Copy the application code with correct ownership
21
+ COPY --chown=node:node . .
22
+
23
+ # Expose port 7860 (required for Hugging Face Spaces)
24
+ EXPOSE 7860
25
+
26
+ # Start the application using Node.js
27
+ CMD ["node", "src/server.js"]