FROM node:22-slim # Install system dependencies including FFmpeg and yt-dlp dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ python3 \ curl \ && rm -rf /var/lib/apt/lists/* # Install yt-dlp binary RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \ && chmod a+rx /usr/local/bin/yt-dlp WORKDIR /app # Copy dependencies manifest COPY package*.json ./ RUN npm ci --omit=dev # Copy application source COPY . . # Ensure all directories exist and are fully writable by any user (Hugging Face Spaces runs as user 1000) RUN mkdir -p /app/data /app/logs /app/temp && \ chmod -R 777 /app && \ chown -R node:node /app # Run the app as non-root user (node is UID 1000) USER node # Expose local ports (7860 is Hugging Face default, 3000 is default local) EXPOSE 7860 EXPOSE 3000 EXPOSE 3001 CMD ["npm", "start"]