docker: latest backend dockerization attempt but crash
This commit is contained in:
+13
-2
@@ -46,8 +46,9 @@ def get_chrome_path() -> str:
|
||||
"/usr/bin/chromium-browser",
|
||||
"/usr/bin/chromium",
|
||||
"/opt/chrome/chrome",
|
||||
"opt/google/chrome/chrome",
|
||||
"/usr/local/bin/chrome",
|
||||
"/opt/google/chrome/chrome-headless-shell",
|
||||
"/opt/google/chrome/chrome",
|
||||
#"/app/chrome_bundle/chrome136/chrome-linux64"
|
||||
]
|
||||
|
||||
@@ -84,6 +85,7 @@ def install_chromedriver() -> str:
|
||||
# if os.path.exists("/app/chrome_bundle/chrome136/chromedriver"):
|
||||
# print("Using bundled ChromeDriver from /app/chrome_bundle/chrome136/chromedriver")
|
||||
# chromedriver_path = "/app/chrome_bundle/chrome136/chromedriver"
|
||||
print("path:", chromedriver_path)
|
||||
if not chromedriver_path:
|
||||
try:
|
||||
print("ChromeDriver not found, attempting to install automatically...")
|
||||
@@ -132,7 +134,8 @@ def create_driver(headless=False, stealth_mode=True, crx_path="./crx/nopecha.crx
|
||||
chrome_options.binary_location = chrome_path
|
||||
|
||||
if headless:
|
||||
chrome_options.add_argument("--headless")
|
||||
#chrome_options.add_argument("--headless")
|
||||
chrome_options.add_argument("--headless=new")
|
||||
chrome_options.add_argument("--disable-gpu")
|
||||
chrome_options.add_argument("--disable-webgl")
|
||||
user_data_dir = tempfile.mkdtemp()
|
||||
@@ -142,6 +145,14 @@ def create_driver(headless=False, stealth_mode=True, crx_path="./crx/nopecha.crx
|
||||
chrome_options.add_argument(f"--accept-lang={lang}-{lang.upper()},{lang};q=0.9")
|
||||
chrome_options.add_argument("--timezone=Europe/Paris")
|
||||
chrome_options.add_argument("--no-sandbox")
|
||||
chrome_options.add_argument('--disable-dev-shm-usage')
|
||||
chrome_options.add_argument('--remote-debugging-port=9222')
|
||||
chrome_options.add_argument('--disable-extensions')
|
||||
chrome_options.add_argument('--disable-background-timer-throttling')
|
||||
chrome_options.add_argument('--disable-backgrounding-occluded-windows')
|
||||
chrome_options.add_argument('--disable-renderer-backgrounding')
|
||||
chrome_options.add_argument('--disable-features=TranslateUI')
|
||||
chrome_options.add_argument('--disable-ipc-flooding-protection')
|
||||
chrome_options.add_argument("--disable-dev-shm-usage")
|
||||
chrome_options.add_argument("--mute-audio")
|
||||
chrome_options.add_argument("--disable-notifications")
|
||||
|
||||
Reference in New Issue
Block a user