From 644c9916e76f53ca8b6d6ac3b09d40e315636755 Mon Sep 17 00:00:00 2001 From: "Khoa.vo" Date: Fri, 19 Dec 2025 14:30:02 +0700 Subject: [PATCH] Fix: Add xauth for xvfb-run, improve .dockerignore, cleanup unused files --- .dockerignore | 27 +++++++++++++++++++++++++++ Dockerfile | 10 +++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index ef16414..4bec572 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,15 +1,42 @@ +# Dependencies node_modules/ +backend/venv/ venv/ __pycache__/ *.pyc + +# Git .git/ .gitignore + +# Logs and temp *.log *.md .DS_Store + +# IDE .vscode/ .idea/ + +# Cache and session cache/ +backend/cache/ backend/session/ +backend/downloads/ + +# Sensitive files +backend/cookies.json +backend/cookies_netscape.txt +backend/session_metadata.json +backend/user_agent.json +backend/.env +.env + +# Test files +backend/test_*.py +backend/debug_*.html playwright-report/ test-results/ + +# Frontend build (we copy from npm build) +frontend/node_modules/ diff --git a/Dockerfile b/Dockerfile index 1aba788..8db973e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libgtk-3-0 \ fonts-liberation \ xvfb \ + xauth \ && rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -43,9 +44,12 @@ WORKDIR /app # Copy backend requirements and install COPY backend/requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt - -# Install Playwright browsers -RUN playwright install chromium +# Install Playwright browsers with retries +RUN mkdir -p /root/.cache/ms-playwright && \ + for i in 1 2 3; do \ + playwright install chromium && break || \ + (echo "Retry $i..." && rm -rf /root/.cache/ms-playwright/__dirlock && sleep 5); \ + done # Copy backend code COPY backend/ ./backend/