Spaces:
Running
Running
| 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"] | |