| FROM python:3.11-slim | |
| # Install system dependencies | |
| # RUN apt-get update && apt-get install -y \ | |
| # wget \ | |
| # gnupg \ | |
| # curl \ | |
| # unzip \ | |
| # xvfb \ | |
| # libgconf-2-4 \ | |
| # libxss1 \ | |
| # libnss3 \ | |
| # libnspr4 \ | |
| # libasound2 \ | |
| # libatk1.0-0 \ | |
| # libatk-bridge2.0-0 \ | |
| # libcups2 \ | |
| # libdbus-1-3 \ | |
| # libdrm2 \ | |
| # libgbm1 \ | |
| # libgtk-3-0 \ | |
| # libxcomposite1 \ | |
| # libxdamage1 \ | |
| # libxfixes3 \ | |
| # libxrandr2 \ | |
| # xdg-utils \ | |
| # fonts-liberation \ | |
| # dbus \ | |
| # xauth \ | |
| # xvfb \ | |
| # x11vnc \ | |
| # tigervnc-tools \ | |
| # supervisor \ | |
| # net-tools \ | |
| # procps \ | |
| # git \ | |
| # python3-numpy \ | |
| # fontconfig \ | |
| # fonts-dejavu \ | |
| # fonts-dejavu-core \ | |
| # fonts-dejavu-extra \ | |
| # nodejs \ | |
| # npm \ | |
| # && apt-get update --fix-missing \ | |
| # && rm -rf /var/lib/apt/lists/* | |
| # Install noVNC | |
| # RUN git clone https://github.com/novnc/noVNC.git /opt/novnc \ | |
| # && git clone https://github.com/novnc/websockify /opt/novnc/utils/websockify \ | |
| # && ln -s /opt/novnc/vnc.html /opt/novnc/index.html | |
| # Install Chrome | |
| RUN curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \ | |
| && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list | |
| # Set up working directory | |
| WORKDIR /app | |
| COPY templates/ templates/ | |
| COPY browser_agent.py . | |
| COPY process_run.py . | |
| COPY utils.py . | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Clone and install BrowserGym from GitHub | |
| # RUN git clone https://github.com/browser-gym/browsergym.git BrowserGym | |
| COPY BrowserGym/ BrowserGym/ | |
| RUN cd BrowserGym && make install-demo | |
| # Install Playwright through pip first | |
| RUN pip install playwright | |
| # RUN playwright install --with-deps chromium | |
| # RUN playwright install-deps | |
| # Install Chrome | |
| RUN apt-get update --fix-missing && apt-get install -y google-chrome-stable | |
| # Copy the application code | |
| COPY . . | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV BROWSER_USE_LOGGING_LEVEL=info | |
| ENV CHROME_PATH=/usr/bin/google-chrome | |
| # ENV ANONYMIZED_TELEMETRY=false | |
| ENV DISPLAY=:99 | |
| ENV RESOLUTION=1920x1080x24 | |
| ENV VNC_PASSWORD=vncpassword | |
| ENV CHROME_PERSISTENT_SESSION=true | |
| ENV RESOLUTION_WIDTH=1920 | |
| ENV RESOLUTION_HEIGHT=1080 | |
| # Set up supervisor configuration | |
| # RUN mkdir -p /var/log/supervisor | |
| # COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
| # EXPOSE 7788 6080 5900 | |
| EXPOSE 7860 | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| # CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] | |
| CMD ["python", "app.py"] |