- Add automatic recording stop when user turns off camera/screenshare - Listen for startStreaming events to detect video_ssrc=0 (camera/screen off) - Add disconnect and connection close event handling - Implement proper cleanup of event listeners to prevent memory leaks - Add targetUserId tracking for accurate event filtering - Update both videoRecording.js and webcamRecording.js services - Update discord.js-selfbot-v13 submodule with latest webcam recording fixes
61 lines
2.2 KiB
Text
61 lines
2.2 KiB
Text
# --- Stage 1: Install node_modules ---
|
|
FROM node:20-slim as dependencies
|
|
|
|
# Install build tools needed for native modules like sodium
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential libtool autoconf automake libsodium-dev python3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /opt/bot
|
|
COPY package*.json ./
|
|
RUN npm install --no-audit --no-fund
|
|
|
|
# --- Stage 2: Development Build ---
|
|
FROM node:20-slim
|
|
|
|
# Install system dependencies for Discord and virtual display
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
curl ca-certificates sudo \
|
|
# ── Discord runtime deps ──────────────────
|
|
libatomic1 libnotify4 libnspr4 libnss3 libxss1 libgbm1 \
|
|
libgconf-2-4 libxtst6 libgtk-3-0 \
|
|
# ── GUI / audio / misc ───────────────────
|
|
xvfb pulseaudio openbox \
|
|
tigervnc-standalone-server tigervnc-common fonts-liberation \
|
|
x11vnc \
|
|
# ── Audio processing for voice recording ──
|
|
ffmpeg libopus0 libopus-dev \
|
|
# ── Encryption and build tools for video recording ──
|
|
libsodium23 libsodium-dev build-essential libtool autoconf \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Download and install Discord
|
|
WORKDIR /opt/preinstall
|
|
RUN curl -L https://discord.com/api/download/stable?platform=linux -o discord.deb && \
|
|
dpkg -i discord.deb || apt-get -f install -y
|
|
|
|
# Create a non-root user
|
|
RUN useradd --create-home --shell /bin/bash bot && \
|
|
adduser bot sudo && \
|
|
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
|
|
# Set up the bot directory
|
|
WORKDIR /opt/bot
|
|
# Copy pre-installed node_modules from the 'dependencies' stage
|
|
COPY --from=dependencies /opt/bot/node_modules ./node_modules
|
|
# Copy entrypoint and set permissions
|
|
COPY entry.sh .
|
|
RUN chmod +x /opt/bot/entry.sh
|
|
# The rest of the source code will be mounted as a volume
|
|
|
|
# Set ownership and user
|
|
RUN chown -R bot:bot /opt/bot
|
|
USER bot
|
|
|
|
# Set environment and entrypoint
|
|
ENV DISPLAY=:99
|
|
RUN mkdir -p /run/dbus
|
|
ENTRYPOINT dbus-daemon --system --fork --nofork --address unix:/run/dbus/system_bus_socket & exec /opt/bot/entry.sh "$@"
|