File size: 1,642 Bytes
4e3b382
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
# ═══════════════════════════════════════════════════════════════════════════
# CONSTITUENT DOCKERFILE
# HuggingFace Docker Space β€” Node.js + FFmpeg streaming server
# ═══════════════════════════════════════════════════════════════════════════

FROM node:20-slim

# Install ffmpeg and system utilities
RUN apt-get update && apt-get install -y \
    ffmpeg \
    procps \
    curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy package files first for layer caching
COPY package.json ./

# Install dependencies
RUN npm install --omit=dev

# Copy application files
COPY server.js ./server.js

# Create required directories
RUN mkdir -p others/temp others/songs others/hls others/data

# HuggingFace Spaces runs on port 7860 by default
EXPOSE 7860

# Environment variables that MUST be set as HuggingFace Space secrets:
#   CONSTITUENT_OWNER_ID  β€” the userId from your main DB who owns this space
#   MAIN_SERVER_SECRET    β€” shared secret so only your main server can call add-movie
#   TMDB_KEY              β€” (optional) for TMDB enrichment
ENV PORT=7860
ENV NODE_ENV=production

# Health check β€” HuggingFace polls this to decide if the space is healthy
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD curl -f http://localhost:7860/constituent/health || exit 1

CMD ["node", "server.js"]