urstark commited on
Commit
b9f6fbc
·
1 Parent(s): f9a19cd

fix: use built-in node user instead of creating new one

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -7
Dockerfile CHANGED
@@ -13,23 +13,22 @@ RUN apt-get update && \
13
  apt-get clean && \
14
  rm -rf /var/lib/apt/lists/*
15
 
16
- # Add user 1000 for Hugging Face Spaces
17
- RUN useradd -m -u 1000 user
18
- USER user
19
- ENV HOME=/home/user \
20
- PATH=/home/user/.local/bin:$PATH
21
 
22
  # Set the working directory in the container
23
  WORKDIR $HOME/app
24
 
25
  # Copy package.json and package-lock.json with correct permissions
26
- COPY --chown=user package*.json ./
27
 
28
  # Install dependencies
29
  RUN npm install
30
 
31
  # Copy the rest of the application code with correct permissions
32
- COPY --chown=user . .
33
 
34
  # Build the frontend (Vite)
35
  RUN npm run build
 
13
  apt-get clean && \
14
  rm -rf /var/lib/apt/lists/*
15
 
16
+ # The official Node image already has a user 'node' with UID 1000
17
+ USER node
18
+ ENV HOME=/home/node \
19
+ PATH=/home/node/.local/bin:$PATH
 
20
 
21
  # Set the working directory in the container
22
  WORKDIR $HOME/app
23
 
24
  # Copy package.json and package-lock.json with correct permissions
25
+ COPY --chown=node package*.json ./
26
 
27
  # Install dependencies
28
  RUN npm install
29
 
30
  # Copy the rest of the application code with correct permissions
31
+ COPY --chown=node . .
32
 
33
  # Build the frontend (Vite)
34
  RUN npm run build