admin08077 commited on
Commit
200f3d9
·
verified ·
1 Parent(s): 546ff54

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -15
Dockerfile CHANGED
@@ -1,32 +1,29 @@
1
- # Use an official Node.js image (adjust version as needed)
2
  FROM node:20
3
 
4
- # Create a non-root user with UID 1000 (matches HF Spaces)
5
- RUN useradd -m -u 1000 user
 
6
 
7
- # Set environment variables for the user
8
- ENV HOME=/home/user \
9
- PATH=/home/user/.local/bin:$PATH
10
-
11
- # Set working directory inside the user's home
12
  WORKDIR $HOME/app
13
 
14
  # Install unzip and any other utilities
15
  RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
16
 
17
- # Copy zip file with correct ownership
18
- COPY --chown=user:user Archive.zip .
19
 
20
- # Unzip as root (so unzip is available) then change ownership in one step
21
- RUN unzip Archive.zip && rm Archive.zip && chown -R user:user $HOME/app
22
 
23
- # Switch to the non-root user
24
- USER user
25
 
26
  # Install dependencies
27
  RUN npm install
28
 
29
- # Expose the app port (adjust if needed)
30
  EXPOSE 3000
31
 
32
  # Start the app
 
1
+ # Use an official Node.js image
2
  FROM node:20
3
 
4
+ # Set environment variables for node user
5
+ ENV HOME=/home/node \
6
+ PATH=/home/node/.local/bin:$PATH
7
 
8
+ # Set working directory inside node's home
 
 
 
 
9
  WORKDIR $HOME/app
10
 
11
  # Install unzip and any other utilities
12
  RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Copy zip file with correct ownership directly to the app folder
15
+ COPY --chown=node:node Archive.zip .
16
 
17
+ # Unzip as root (so unzip works) then fix permissions in one step
18
+ RUN unzip Archive.zip && rm Archive.zip && chown -R node:node $HOME/app
19
 
20
+ # Switch to the non-root node user
21
+ USER node
22
 
23
  # Install dependencies
24
  RUN npm install
25
 
26
+ # Expose the app port
27
  EXPOSE 3000
28
 
29
  # Start the app