mrpoddaa commited on
Commit
daddfb8
Β·
verified Β·
1 Parent(s): 8af9fb7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -6
Dockerfile CHANGED
@@ -3,8 +3,8 @@
3
  # ──────────────────────────────────────────────
4
  FROM node:20-slim
5
 
6
- # HF Spaces runs containers as uid 1000
7
- RUN useradd -m -u 1000 appuser
8
 
9
  WORKDIR /app
10
 
@@ -12,17 +12,18 @@ WORKDIR /app
12
  COPY package.json ./
13
  RUN npm install --omit=dev
14
 
15
- # Copy application source
16
- COPY --chown=appuser:appuser . .
17
 
18
  # Hugging Face Spaces requires port 7860
19
  ENV PORT=7860
20
  EXPOSE 7860
21
 
22
- USER appuser
 
23
 
24
  # HF pings /system to verify the app is healthy
25
  HEALTHCHECK --interval=30s --timeout=10s --start-period=20s \
26
  CMD node -e "require('http').get('http://localhost:7860/system',r=>{process.exit(r.statusCode===200?0:1)}).on('error',()=>process.exit(1))"
27
 
28
- CMD ["node", "index.js"]
 
3
  # ──────────────────────────────────────────────
4
  FROM node:20-slim
5
 
6
+ # node:20-slim already has a built-in 'node' user at uid 1000
7
+ # DO NOT run useradd β€” uid 1000 already exists and will error
8
 
9
  WORKDIR /app
10
 
 
12
  COPY package.json ./
13
  RUN npm install --omit=dev
14
 
15
+ # Copy application source with correct ownership
16
+ COPY --chown=node:node . .
17
 
18
  # Hugging Face Spaces requires port 7860
19
  ENV PORT=7860
20
  EXPOSE 7860
21
 
22
+ # Use the built-in node user (uid 1000) β€” required by HF Spaces
23
+ USER node
24
 
25
  # HF pings /system to verify the app is healthy
26
  HEALTHCHECK --interval=30s --timeout=10s --start-period=20s \
27
  CMD node -e "require('http').get('http://localhost:7860/system',r=>{process.exit(r.statusCode===200?0:1)}).on('error',()=>process.exit(1))"
28
 
29
+ CMD ["node", "index.js"]