Adds Dockerfile.gui with Xvfb, VNC, and noVNC for running the bot with a visible browser in Docker: - Xvfb virtual framebuffer for headless display - x11vnc for VNC access - noVNC for browser-based access at http://localhost:6080 - Playwright chromium with system dependencies - docker-compose.gui.yml for easy startuppull/2484/head
parent
569f25098a
commit
97087673e6
@ -0,0 +1,35 @@
|
||||
FROM python:3.10.14-slim
|
||||
|
||||
# Install system dependencies including browser support and VNC
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ffmpeg \
|
||||
xvfb \
|
||||
x11vnc \
|
||||
novnc \
|
||||
websockify \
|
||||
fluxbox \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set display for headless browser
|
||||
ENV DISPLAY=:99
|
||||
ENV VNC_PORT=5900
|
||||
ENV NOVNC_PORT=6080
|
||||
|
||||
RUN mkdir /app
|
||||
ADD . /app
|
||||
WORKDIR /app
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Install Playwright browsers with system dependencies
|
||||
RUN playwright install --with-deps chromium
|
||||
|
||||
# Copy the entrypoint script
|
||||
COPY docker-gui-entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
EXPOSE 5900 6080
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["python3", "main.py"]
|
||||
@ -0,0 +1,15 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
reddit-bot-gui:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.gui
|
||||
ports:
|
||||
- "5900:5900" # VNC
|
||||
- "6080:6080" # noVNC (web browser access)
|
||||
volumes:
|
||||
- ./results:/app/results
|
||||
- ./.config.toml:/app/.config.toml
|
||||
environment:
|
||||
- DISPLAY=:99
|
||||
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Start virtual framebuffer
|
||||
Xvfb :99 -screen 0 1920x1080x24 &
|
||||
sleep 1
|
||||
|
||||
# Start lightweight window manager
|
||||
fluxbox &
|
||||
|
||||
# Start VNC server (no password by default, use -rfbauth for security)
|
||||
x11vnc -display :99 -forever -nopw -rfbport ${VNC_PORT:-5900} &
|
||||
|
||||
# Start noVNC web client (accessible via browser at http://localhost:6080)
|
||||
websockify --web /usr/share/novnc/ ${NOVNC_PORT:-6080} localhost:${VNC_PORT:-5900} &
|
||||
|
||||
echo "============================================"
|
||||
echo " GUI is available at:"
|
||||
echo " VNC: vnc://localhost:${VNC_PORT:-5900}"
|
||||
echo " Web: http://localhost:${NOVNC_PORT:-6080}/vnc.html"
|
||||
echo "============================================"
|
||||
|
||||
# Run the main command
|
||||
exec "$@"
|
||||
Loading…
Reference in new issue