# Use Node.js 20 on Debian FROM node:20-slim # 1. Install FFmpeg, Chromium, and Xvfb (Virtual Display) RUN apt-get update && apt-get install -y \ ffmpeg \ chromium \ fonts-liberation \ libnss3 \ libatk-bridge2.0-0 \ libcups2 \ libxcomposite1 \ libxdamage1 \ libxrandr2 \ libgbm1 \ libasound2 \ xvfb \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # 2. Copy package files and install COPY package.json ./ RUN npm install # 3. Copy the rest of the code COPY . . # 4. Set Puppeteer to use the installed Chromium ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium ENV DISPLAY=:99 # 5. Start a virtual display and then start the bot CMD Xvfb :99 -screen 0 1280x720x24 & npm start