Use Playwright base image for worker services
Replace chromium/chromedriver apt installs with mcr.microsoft.com/playwright:v1.62.0-noble for worker containers. Admin service stays on python:3.11-slim since it doesn't need Chrome. This removes the build-time patch_driver.py step since Playwright ships with a pre-patched Chromium binary. Also split docker-compose into separate images (seed-admin / seed-worker) with explicit build targets. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
+10
-11
@@ -15,8 +15,11 @@ services:
|
||||
|
||||
# ── Admin panel (FastAPI) ─────────────────────────────────────────────────────
|
||||
admin:
|
||||
build: .
|
||||
image: seed:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: admin
|
||||
image: seed-admin:latest
|
||||
hostname: crawler-admin
|
||||
container_name: seed-admin
|
||||
restart: unless-stopped
|
||||
@@ -32,8 +35,6 @@ services:
|
||||
REDIS_URL: "redis://redis:6379/0"
|
||||
SKIP_INTERNAL_WORKER: "true"
|
||||
HEADLESS: "true"
|
||||
CHROME_BINARY: /usr/bin/chromium
|
||||
CHROMEDRIVER_PATH: /usr/bin/chromedriver
|
||||
RECORDINGS_DIR: /app/recordings
|
||||
volumes:
|
||||
- seed-data:/app/data
|
||||
@@ -54,8 +55,11 @@ services:
|
||||
|
||||
# ── RQ worker (Chrome crawler, runs batch jobs) ───────────────────────────────
|
||||
worker:
|
||||
build: .
|
||||
image: seed:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: worker
|
||||
image: seed-worker:latest
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
replicas: 3
|
||||
@@ -67,8 +71,6 @@ services:
|
||||
LOG_FILE: /app/logs/seed.log
|
||||
REDIS_URL: "redis://redis:6379/0"
|
||||
HEADLESS: "true"
|
||||
CHROME_BINARY: /usr/bin/chromium
|
||||
CHROMEDRIVER_PATH: /usr/bin/chromedriver
|
||||
RECORD_SESSIONS: "true"
|
||||
RECORDING_FPS: "12"
|
||||
RECORDING_MAX_FILES: "3"
|
||||
@@ -80,9 +82,6 @@ services:
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
# Chrome needs extra shared memory to avoid OOM crashes
|
||||
# Headful Chromium recording needs substantially more shared memory than
|
||||
# headless mode. This is a limit, not an up-front RAM allocation.
|
||||
shm_size: "2gb"
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
|
||||
Reference in New Issue
Block a user