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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -9
Dockerfile CHANGED
@@ -1,29 +1,37 @@
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}"]
 
 
 
 
 
 
 
 
 
1
+ # Use a small Node.js base image
2
  FROM node:18-alpine
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Copy package files first for caching
8
  COPY package*.json ./
9
 
10
  # Install dependencies
11
  RUN npm install
12
 
13
+ # Copy all files
14
  COPY . .
15
 
16
+ # Build the app (this generates 'build' or 'dist' folder)
17
  RUN npm run build
18
 
19
+ # Install a lightweight static file server
20
  RUN npm install -g serve
21
 
22
+ # Default port (Hugging Face will override this)
23
  ENV PORT=7860
24
 
25
+ # Expose the port
26
  EXPOSE 7860
27
 
28
+ # === IMPORTANT ===
29
+ # For React (CRA): folder is 'build'
30
+ # For Vite / Vue / Svelte: folder is 'dist'
31
+ # Uncomment the correct line below:
32
+
33
+ # For React (create-react-app):
34
+ # CMD ["sh", "-c", "serve -s build -l tcp://0.0.0.0:${PORT}"]
35
+
36
+ # For Vite / Vue / Svelte (most modern setups):
37
+ CMD ["sh", "-c", "serve -s dist -l tcp://0.0.0.0:${PORT}"]