# Use an official Node.js runtime as base image | |
FROM node:18 | |
# Set working directory | |
WORKDIR /app | |
# Install required dependencies (including Chromium for Playwright) | |
RUN apt-get update && apt-get install -y \ | |
wget \ | |
libnss3 \ | |
libatk1.0-0 \ | |
libpangocairo-1.0-0 \ | |
libx11-xcb1 \ | |
libxcomposite1 \ | |
libxcursor1 \ | |
libxdamage1 \ | |
libxfixes3 \ | |
libxi6 \ | |
libxrandr2 \ | |
libgbm1 \ | |
libasound2 \ | |
libpango-1.0-0 \ | |
libatk-bridge2.0-0 \ | |
libgtk-3-0 | |
# Install Node.js dependencies | |
RUN npm install express axios cheerio puppeteer-core playwright cors | |
# Set Puppeteer to use Playwright's Chromium | |
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium | |
# Copy project files | |
COPY . . | |
# Expose API port | |
EXPOSE 7860 | |
# Run the application | |
CMD ["node", "server.js"] |