Skip to content

Commit 383b04a

Browse files
authored
Merge pull request #583 from vvincent1234/fix/docker
Fix/docker
2 parents 0146570 + 33763b1 commit 383b04a

19 files changed

+836
-936
lines changed

.dockerignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
data
2-
tmp
2+
tmp
3+
results
4+
5+
.env

.env.example

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ ANONYMIZED_TELEMETRY=false
4040
# LogLevel: Set to debug to enable verbose logging, set to result to get results only. Available: result | debug | info
4141
BROWSER_USE_LOGGING_LEVEL=info
4242

43-
# Chrome settings
44-
CHROME_PATH=
45-
CHROME_USER_DATA=
46-
CHROME_DEBUGGING_PORT=9222
47-
CHROME_DEBUGGING_HOST=localhost
43+
# Browser settings
44+
BROWSER_PATH=
45+
BROWSER_USER_DATA=
46+
BROWSER_DEBUGGING_PORT=9222
47+
BROWSER_DEBUGGING_HOST=localhost
4848
# Set to true to keep browser open between AI tasks
49-
CHROME_PERSISTENT_SESSION=false
50-
CHROME_CDP=
49+
KEEP_BROWSER_OPEN=true
50+
BROWSER_CDP=
5151
# Display settings
5252
# Format: WIDTHxHEIGHTxDEPTH
5353
RESOLUTION=1920x1080x24

Dockerfile

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM python:3.11-slim
22

3+
# Set platform for multi-arch builds (Docker Buildx will set this)
4+
ARG TARGETPLATFORM
5+
ARG NODE_MAJOR=20
6+
37
# Install system dependencies
48
RUN apt-get update && apt-get install -y \
59
wget \
@@ -28,7 +32,6 @@ RUN apt-get update && apt-get install -y \
2832
fonts-liberation \
2933
dbus \
3034
xauth \
31-
xvfb \
3235
x11vnc \
3336
tigervnc-tools \
3437
supervisor \
@@ -40,47 +43,58 @@ RUN apt-get update && apt-get install -y \
4043
fonts-dejavu \
4144
fonts-dejavu-core \
4245
fonts-dejavu-extra \
46+
vim \
4347
&& rm -rf /var/lib/apt/lists/*
4448

4549
# Install noVNC
4650
RUN git clone https://github.com/novnc/noVNC.git /opt/novnc \
4751
&& git clone https://github.com/novnc/websockify /opt/novnc/utils/websockify \
4852
&& ln -s /opt/novnc/vnc.html /opt/novnc/index.html
4953

50-
# Set platform for ARM64 compatibility
51-
ARG TARGETPLATFORM=linux/amd64
54+
# Install Node.js using NodeSource PPA
55+
RUN mkdir -p /etc/apt/keyrings \
56+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
57+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
58+
&& apt-get update \
59+
&& apt-get install nodejs -y \
60+
&& rm -rf /var/lib/apt/lists/*
61+
62+
# Verify Node.js and npm installation (optional, but good for debugging)
63+
RUN node -v && npm -v && npx -v
5264

5365
# Set up working directory
5466
WORKDIR /app
5567

5668
# Copy requirements and install Python dependencies
5769
COPY requirements.txt .
70+
# Ensure 'patchright' is in your requirements.txt or install it directly
71+
# RUN pip install --no-cache-dir -r requirements.txt patchright # If not in requirements
5872
RUN pip install --no-cache-dir -r requirements.txt
5973

60-
# Install patchright and browsers with system dependencies
61-
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-patchright
62-
RUN patchright install --with-deps chromium
63-
RUN patchright install-deps
74+
# Install Patchright browsers and dependencies
75+
# Patchright documentation suggests PLAYWRIGHT_BROWSERS_PATH is still relevant
76+
# or that Patchright installs to a similar default location that Playwright would.
77+
# Let's assume Patchright respects PLAYWRIGHT_BROWSERS_PATH or its default install location is findable.
78+
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-browsers
79+
RUN mkdir -p $PLAYWRIGHT_BROWSERS_PATH
80+
81+
# Install recommended: Google Chrome (instead of just Chromium for better undetectability)
82+
# The 'patchright install chrome' command might download and place it.
83+
# The '--with-deps' equivalent for patchright install is to run 'patchright install-deps chrome' after.
84+
# RUN patchright install chrome --with-deps
85+
86+
# Alternative: Install Chromium if Google Chrome is problematic in certain environments
87+
RUN patchright install chromium --with-deps
88+
6489

6590
# Copy the application code
6691
COPY . .
6792

68-
# Set environment variables
69-
ENV PYTHONUNBUFFERED=1
70-
ENV BROWSER_USE_LOGGING_LEVEL=info
71-
ENV CHROME_PATH=/ms-playwright/chromium-*/chrome-linux/chrome
72-
ENV ANONYMIZED_TELEMETRY=false
73-
ENV DISPLAY=:99
74-
ENV RESOLUTION=1920x1080x24
75-
ENV VNC_PASSWORD=vncpassword
76-
ENV CHROME_PERSISTENT_SESSION=true
77-
ENV RESOLUTION_WIDTH=1920
78-
ENV RESOLUTION_HEIGHT=1080
79-
8093
# Set up supervisor configuration
8194
RUN mkdir -p /var/log/supervisor
8295
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
8396

84-
EXPOSE 7788 6080 5901
97+
EXPOSE 7788 6080 5901 9222
8598

8699
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
100+
#CMD ["/bin/bash"]

Dockerfile.arm64

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)