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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -12
Dockerfile CHANGED
@@ -1,26 +1,25 @@
1
- # Use an official Node.js runtime as the base image
2
  FROM node:18-alpine
3
 
4
- # Set working directory inside the container
5
  WORKDIR /app
6
 
7
- # Copy package.json and package-lock.json first (for caching)
8
  COPY package*.json ./
9
-
10
- # Install dependencies
11
  RUN npm install
12
 
13
- # Copy the rest of the project files
14
  COPY . .
15
-
16
- # Build the app for production
17
  RUN npm run build
18
 
19
- # Install a simple static file server to serve the built files
20
  RUN npm install -g serve
21
 
22
- # Expose the port your app will run on
 
 
 
23
  EXPOSE 3000
24
 
25
- # Command to run the app
26
- CMD ["serve", "-s", "build", "-l", "3000"]
 
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}"]