FROM node:20-slim # Install dependencies RUN apt update && apt install -y \ wget \ curl \ ca-certificates \ gnupg \ xvfb \ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ && apt update && apt install -y google-chrome-stable \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /app RUN mkdir -p /app/data COPY package*.json ./ RUN npm install COPY . . EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 # Start command - run test.js first, then index.js CMD Xvfb :99 -screen 0 1024x768x16 & \ export DISPLAY=:99 && \ sleep 5 && \ echo "Running test.js to create session..." && \ if [ -f "test.js" ]; then \ node test.js || echo "test.js completed (exit code: $?)"; \ else \ echo "test.js not found, skipping..."; \ fi && \ echo "Starting main bot..." && \ node index.js