FROM node:20-bookworm

RUN apt-get update && apt-get install -y \
    git \
    ffmpeg \
    curl \
    wget \
    && rm -rf /var/lib/apt/lists/*

RUN wget -q https://github.com/cloudflare/cloudflared/releases/download/2025.11.1/cloudflared-linux-amd64.deb \
    && dpkg -i cloudflared-linux-amd64.deb \
    && rm cloudflared-linux-amd64.deb

WORKDIR /app

RUN git clone https://git.waifuboard.app/ItsSkaiya/WaifuBoard.git repo

RUN mv repo/docker/* . \
    && rm -rf repo

RUN npm install

RUN npx playwright install chromium
RUN npx playwright install-deps

EXPOSE 54322
CMD ["npm", "run", "start"]
