Update wrapper/docker-entrypoint.sh
This commit is contained in:
		
							parent
							
								
									fb8eebb160
								
							
						
					
					
						commit
						d4f7681f30
					
				@ -33,15 +33,17 @@ if [ -f requirements.txt ]; then
 | 
				
			|||||||
  pip install --no-cache-dir -r requirements.txt
 | 
					  pip install --no-cache-dir -r requirements.txt
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Cache Playwright browsers in /cache so they persist across restarts
 | 
					# Keep Playwright browsers in a persistent volume
 | 
				
			||||||
export PLAYWRIGHT_BROWSERS_PATH="${PLAYWRIGHT_BROWSERS_PATH:-/cache/pw-browsers}"
 | 
					export PLAYWRIGHT_BROWSERS_PATH="${PLAYWRIGHT_BROWSERS_PATH:-/cache/pw-browsers}"
 | 
				
			||||||
mkdir -p "$PLAYWRIGHT_BROWSERS_PATH"
 | 
					mkdir -p "$PLAYWRIGHT_BROWSERS_PATH"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# If playwright is available, ensure Chromium is installed
 | 
					# If Playwright is installed, make sure Chromium + deps are installed too
 | 
				
			||||||
if python -c "import playwright" >/dev/null 2>&1; then
 | 
					if python -c "import playwright" >/dev/null 2>&1; then
 | 
				
			||||||
  if [ ! -d "$PLAYWRIGHT_BROWSERS_PATH" ] || [ -z "$(ls -A "$PLAYWRIGHT_BROWSERS_PATH" 2>/dev/null)" ]; then
 | 
					  if [ ! -d "$PLAYWRIGHT_BROWSERS_PATH" ] || [ -z "$(ls -A "$PLAYWRIGHT_BROWSERS_PATH" 2>/dev/null)" ]; then
 | 
				
			||||||
    echo "[Wrapper] Installing Playwright Chromium to $PLAYWRIGHT_BROWSERS_PATH ..."
 | 
					    echo "[Wrapper] Installing Playwright Chromium (with deps) to $PLAYWRIGHT_BROWSERS_PATH ..."
 | 
				
			||||||
    python -m playwright install chromium || python -m playwright install --with-deps chromium
 | 
					    # Prefer the combined install; fall back to plain install if --with-deps isn't available
 | 
				
			||||||
 | 
					    python -m playwright install --with-deps chromium || \
 | 
				
			||||||
 | 
					    (python -m playwright install-deps chromium && python -m playwright install chromium)
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    echo "[Wrapper] Playwright browser cache present at $PLAYWRIGHT_BROWSERS_PATH"
 | 
					    echo "[Wrapper] Playwright browser cache present at $PLAYWRIGHT_BROWSERS_PATH"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user