pvyas96 commited on
Commit
ed677ce
·
verified ·
1 Parent(s): ad743a9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -18
Dockerfile CHANGED
@@ -1,26 +1,17 @@
1
- # Use Node.js environment
2
- FROM node:20-alpine
3
-
4
- # Set working directory
5
  WORKDIR /app
6
-
7
- # Copy package files first (better caching)
8
  COPY package*.json ./
9
-
10
- # Install dependencies
11
  RUN npm install
12
-
13
- # Install a simple static file server
14
- RUN npm install -g serve
15
-
16
- # Copy the rest of your application code
17
  COPY . .
18
-
19
- # Build the React application (creates the 'dist' folder)
20
  RUN npm run build
21
 
22
- # Expose port 7860 (Required by Hugging Face Spaces)
 
 
 
 
 
23
  EXPOSE 7860
24
-
25
- # Start the server on port 7860 serving the 'dist' folder
26
  CMD ["serve", "-s", "dist", "-l", "7860"]
 
1
+ # Build Stage
2
+ FROM node:20-alpine AS builder
 
 
3
  WORKDIR /app
 
 
4
  COPY package*.json ./
5
+ # Install dependencies (will work now that package.json is fixed)
 
6
  RUN npm install
 
 
 
 
 
7
  COPY . .
 
 
8
  RUN npm run build
9
 
10
+ # Serve Stage
11
+ FROM node:20-alpine
12
+ WORKDIR /app
13
+ RUN npm install -g serve
14
+ # Copy the 'dist' folder from the builder stage
15
+ COPY --from=builder /app/dist ./dist
16
  EXPOSE 7860
 
 
17
  CMD ["serve", "-s", "dist", "-l", "7860"]