Merge pull request #685 from Akash-ainapur/fix-docker-build

Fixed docker build issue
This commit is contained in:
warmshao
2025-08-31 21:04:52 +08:00
committed by GitHub
2 changed files with 11 additions and 21 deletions

View File

@@ -4,7 +4,7 @@ FROM python:3.11-slim
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG NODE_MAJOR=20 ARG NODE_MAJOR=20
# Install system dependencies # Install system dependencies (removed libgconf-2-4)
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
wget \ wget \
netcat-traditional \ netcat-traditional \
@@ -12,7 +12,6 @@ RUN apt-get update && apt-get install -y \
curl \ curl \
unzip \ unzip \
xvfb \ xvfb \
libgconf-2-4 \
libxss1 \ libxss1 \
libnss3 \ libnss3 \
libnspr4 \ libnspr4 \
@@ -30,6 +29,8 @@ RUN apt-get update && apt-get install -y \
libxrandr2 \ libxrandr2 \
xdg-utils \ xdg-utils \
fonts-liberation \ fonts-liberation \
fonts-noto-color-emoji \
fonts-unifont \
dbus \ dbus \
xauth \ xauth \
x11vnc \ x11vnc \
@@ -56,10 +57,10 @@ RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& 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 \ && 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 \
&& apt-get update \ && apt-get update \
&& apt-get install nodejs -y \ && apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Verify Node.js and npm installation (optional, but good for debugging) # Verify Node.js and npm installation
RUN node -v && npm -v && npx -v RUN node -v && npm -v && npx -v
# Set up working directory # Set up working directory
@@ -67,26 +68,16 @@ WORKDIR /app
# Copy requirements and install Python dependencies # Copy requirements and install Python dependencies
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Install playwright browsers and dependencies # Playwright setup
# playwright documentation suggests PLAYWRIGHT_BROWSERS_PATH is still relevant
# or that playwright installs to a similar default location that Playwright would.
# Let's assume playwright respects PLAYWRIGHT_BROWSERS_PATH or its default install location is findable.
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-browsers ENV PLAYWRIGHT_BROWSERS_PATH=/ms-browsers
RUN mkdir -p $PLAYWRIGHT_BROWSERS_PATH RUN mkdir -p $PLAYWRIGHT_BROWSERS_PATH
# Install recommended: Google Chrome (instead of just Chromium for better undetectability) # Install Chromium via Playwright without --with-deps
# The 'playwright install chrome' command might download and place it. RUN PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0 playwright install chromium
# The '--with-deps' equivalent for playwright install is to run 'playwright install-deps chrome' after.
# RUN playwright install chrome --with-deps
# Alternative: Install Chromium if Google Chrome is problematic in certain environments # Copy application code
RUN playwright install chromium --with-deps
# Copy the application code
COPY . . COPY . .
# Set up supervisor configuration # Set up supervisor configuration
@@ -96,4 +87,3 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 7788 6080 5901 9222 EXPOSE 7788 6080 5901 9222
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
#CMD ["/bin/bash"]

View File

@@ -68,7 +68,7 @@ services:
- /tmp/.X11-unix:/tmp/.X11-unix - /tmp/.X11-unix:/tmp/.X11-unix
# - ./my_chrome_data:/app/data/chrome_data # Optional: persist browser data # - ./my_chrome_data:/app/data/chrome_data # Optional: persist browser data
restart: unless-stopped restart: unless-stopped
shm_size: '2gb' shm_size: "2gb"
cap_add: cap_add:
- SYS_ADMIN - SYS_ADMIN
tmpfs: tmpfs:
@@ -77,4 +77,4 @@ services:
test: ["CMD", "nc", "-z", "localhost", "5901"] # VNC port test: ["CMD", "nc", "-z", "localhost", "5901"] # VNC port
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 3 retries: 3