# Use a Node.js base image FROM node:18 # Set working directory WORKDIR /app # Copy package.json and package-lock.json COPY package*.json ./ # Install dependencies RUN npm install # Install Puppeteer and Chromium as dependencies RUN npm install puppeteer chromium # Install required dependencies (like libx11) for Puppeteer to run headless Chromium RUN apt-get update && apt-get install -y \ wget \ ca-certificates \ fonts-liberation \ libappindicator3-1 \ libasound2 \ libatk-bridge2.0-0 \ libatk1.0-0 \ libcups2 \ libdbus-1-3 \ libgdk-pixbuf2.0-0 \ libnspr4 \ libnss3 \ libx11-xcb1 \ libxcomposite1 \ libxdamage1 \ libxrandr2 \ xdg-utils \ && rm -rf /var/lib/apt/lists/* # Log Chromium installation path RUN echo "Chromium path: $(npm explore chromium -- npm bin)" # Copy the rest of the application COPY . . # Expose the port EXPOSE 7860 # Command to run the app CMD ["node", "server.js"]