1
1
FROM python:3.11-slim
2
2
3
+ # Set platform for multi-arch builds (Docker Buildx will set this)
4
+ ARG TARGETPLATFORM
5
+ ARG NODE_MAJOR=20
6
+
3
7
# Install system dependencies
4
8
RUN apt-get update && apt-get install -y \
5
9
wget \
@@ -28,7 +32,6 @@ RUN apt-get update && apt-get install -y \
28
32
fonts-liberation \
29
33
dbus \
30
34
xauth \
31
- xvfb \
32
35
x11vnc \
33
36
tigervnc-tools \
34
37
supervisor \
@@ -40,47 +43,58 @@ RUN apt-get update && apt-get install -y \
40
43
fonts-dejavu \
41
44
fonts-dejavu-core \
42
45
fonts-dejavu-extra \
46
+ vim \
43
47
&& rm -rf /var/lib/apt/lists/*
44
48
45
49
# Install noVNC
46
50
RUN git clone https://github.com/novnc/noVNC.git /opt/novnc \
47
51
&& git clone https://github.com/novnc/websockify /opt/novnc/utils/websockify \
48
52
&& ln -s /opt/novnc/vnc.html /opt/novnc/index.html
49
53
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
52
64
53
65
# Set up working directory
54
66
WORKDIR /app
55
67
56
68
# Copy requirements and install Python dependencies
57
69
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
58
72
RUN pip install --no-cache-dir -r requirements.txt
59
73
60
- # Install Playwright and browsers with system dependencies
61
- ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
62
- RUN playwright install --with-deps chromium
63
- RUN playwright 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
+
64
89
65
90
# Copy the application code
66
91
COPY . .
67
92
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
-
80
93
# Set up supervisor configuration
81
94
RUN mkdir -p /var/log/supervisor
82
95
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
83
96
84
- EXPOSE 7788 6080 5901
97
+ EXPOSE 7788 6080 5901 9222
85
98
86
99
CMD ["/usr/bin/supervisord" , "-c" , "/etc/supervisor/conf.d/supervisord.conf" ]
100
+ # CMD ["/bin/bash"]
0 commit comments