File size: 810 Bytes
538d81e
 
 
 
 
 
ac2a8d3
538d81e
e218660
 
538d81e
 
 
 
 
e218660
538d81e
 
 
 
 
 
 
 
e218660
538d81e
 
 
 
f7333d7
538d81e
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
# Stage 1: Build the application
FROM node:20-alpine AS builder

WORKDIR /app

# Copy package files
COPY package.json ./

# Install dependencies with npm
RUN npm install

# Copy entire project
COPY . .

# Build the application for production
RUN npm run build

# Stage 2: Runtime
FROM node:20-alpine

WORKDIR /app

# Copy built files from builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

# Copy server script (ES module)
COPY server.js .
COPY --from=builder /app/server/aiCore.js ./server/aiCore.js

# Expose port 7860 (HuggingFace standard)
EXPOSE 7860

# Set environment variables for HuggingFace Spaces
ENV NODE_ENV=production
ENV PORT=7860
ENV HOST=0.0.0.0

# Start the server
CMD ["node", "server.js"]