File size: 1,036 Bytes
f2f99a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM node:22-slim AS builder

# Install FFmpeg for server-side video processing
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy package files and install dependencies
COPY package.json package-lock.json* ./
RUN npm ci --ignore-scripts

# Copy source code
COPY . .

# Build web UI and check types
RUN npx vite build --config vite.config.ts

# Production stage
FROM node:22-slim

RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY package.json package-lock.json* ./
RUN npm ci --ignore-scripts --omit=dev 2>/dev/null || npm ci --ignore-scripts

# Copy built web assets and source (for tsx runtime)
COPY --from=builder /app/dist/web ./dist/web
COPY core/ ./core/
COPY server/ ./server/

# HuggingFace Spaces expects port 7860
ENV PORT=7860
ENV STATIC_DIR=/app/dist/web
EXPOSE 7860

# Run the API server using tsx for TypeScript execution
RUN npm install -g tsx
CMD ["tsx", "server/api.ts"]