wuhp commited on
Commit
a983ceb
·
verified ·
1 Parent(s): 8f486d9

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:22-slim AS builder
2
+
3
+ WORKDIR /app
4
+
5
+ # Copy package files and install dependencies
6
+ COPY package*.json ./
7
+ RUN npm install
8
+
9
+ # Copy application source code
10
+ COPY . .
11
+
12
+ # Build the Vite application
13
+ RUN npm run build
14
+
15
+ # Production runtime image
16
+ FROM node:22-slim
17
+
18
+ WORKDIR /app
19
+
20
+ # Install 'serve' globally to serve static files
21
+ RUN npm install -g serve
22
+
23
+ # Copy built assets from builder stage
24
+ COPY --from=builder /app/dist ./dist
25
+
26
+ # Hugging Face Spaces runs containers as user 1000
27
+ RUN useradd -m -u 1000 user
28
+ USER user
29
+
30
+ # Hugging Face Spaces expects the app to listen on port 7860
31
+ ENV PORT=7860
32
+ EXPOSE 7860
33
+
34
+ # Start the server, routing all requests to index.html (SPA mode)
35
+ CMD ["serve", "-s", "dist", "-l", "7860"]