File size: 688 Bytes
188bf54
 
 
 
 
 
564baf9
188bf54
 
446200c
188bf54
 
564baf9
188bf54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
FROM node:22-alpine AS build

# Set the working directory
WORKDIR /app

# Copy package files first for better caching
COPY package*.json ./

# Install dependencies
RUN npm install --legacy-peer-deps

# Copy the rest of the application
COPY . .

# Build the application
RUN npm run build

# Second stage: Serve the application with a lightweight HTTP server
FROM node:22-alpine
WORKDIR /app

# Install 'serve' tool to host static files
RUN npm install -g serve

# Copy only the built files from the build stage
COPY --from=build /app/dist ./dist

# Hugging Face Spaces expect port 7860
EXPOSE 7860

# Command to serve the static site on port 7860
CMD ["serve", "-s", "dist", "-l", "7860"]