Sarvesh3529 commited on
Commit
9d644cd
·
verified ·
1 Parent(s): 160d275

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -11
Dockerfile CHANGED
@@ -1,20 +1,19 @@
1
  FROM node:20-alpine
2
 
3
- # Set up user permissions for Hugging Face security
4
- RUN useradd -m -u 1000 user
5
- USER user
6
- ENV HOME=/home/user \
7
- PATH=/home/user/.local/bin:$PATH
8
- WORKDIR $HOME/app
9
 
10
- # Copy dependency configs and install
11
- COPY --chown=user package*.json ./
12
  RUN npm install
13
 
14
- # Copy server code
15
- COPY --chown=user . .
16
 
17
- # Hugging Face Spaces routes traffic natively through port 7860
 
 
 
18
  EXPOSE 7860
19
  ENV PORT=7860
20
 
 
1
  FROM node:20-alpine
2
 
3
+ # Set up the working directory inside the pre-existing node user's home
4
+ WORKDIR /home/node/app
 
 
 
 
5
 
6
+ # Copy dependency configs and adjust ownership to the 'node' user
7
+ COPY --chown=node:node package*.json ./
8
  RUN npm install
9
 
10
+ # Copy the rest of your server code
11
+ COPY --chown=node:node . .
12
 
13
+ # Switch to the non-root node user for Hugging Face security
14
+ USER node
15
+
16
+ # Expose the mandatory Hugging Face port
17
  EXPOSE 7860
18
  ENV PORT=7860
19