kumar-aditya commited on
Commit
fb1efd1
·
verified ·
1 Parent(s): ab4296d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -11
Dockerfile CHANGED
@@ -1,25 +1,29 @@
1
- # Dockerfile for Hugging Face Spaces (single file)
2
  FROM node:18-alpine
3
 
4
- # set working dir
5
  WORKDIR /app
6
 
7
- # copy package files and install (use npm ci if you have package-lock.json)
8
  COPY package*.json ./
 
 
9
  RUN npm install
10
 
11
- # copy source and build
12
  COPY . .
 
 
13
  RUN npm run build
14
 
15
- # install a tiny static server
16
  RUN npm install -g serve
17
 
18
- # default port (Hugging Face will inject its PORT env var at runtime)
19
- ENV PORT=3000
20
 
21
- # expose the port (optional; for documentation)
22
- EXPOSE 3000
23
 
24
- # bind to 0.0.0.0 and use the PORT env var; sh -c is used so ${PORT} expands
25
- CMD ["sh", "-c", "serve -s build -l 0.0.0.0:${PORT}"]
 
1
+ # Use a small Node.js image
2
  FROM node:18-alpine
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Copy package files first for better caching
8
  COPY package*.json ./
9
+
10
+ # Install dependencies
11
  RUN npm install
12
 
13
+ # Copy all other files
14
  COPY . .
15
+
16
+ # Build the app (React, Vite, etc.)
17
  RUN npm run build
18
 
19
+ # Install the simple static server globally
20
  RUN npm install -g serve
21
 
22
+ # Set the port (Hugging Face injects PORT automatically)
23
+ ENV PORT=7860
24
 
25
+ # Expose the port for documentation
26
+ EXPOSE 7860
27
 
28
+ # Run the static server (correct syntax for host:port)
29
+ CMD ["sh", "-c", "serve -s build -l tcp://0.0.0.0:${PORT}"]