diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 238bd34..5b87080 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -24,8 +24,27 @@ jobs: run: | docker build -t memorycollection/iptv:latest . + # 测试 Python 无头浏览器是否能运行 + - name: Test Python Headless Chrome + run: | + # 创建一个简单的 Python 脚本测试无头浏览器 + echo ' + from selenium import webdriver + from selenium.webdriver.chrome.options import Options + options = Options() + options.add_argument("--headless") # 无头模式 + options.add_argument("--no-sandbox") + options.add_argument("--disable-dev-shm-usage") + driver = webdriver.Chrome(options=options) + driver.get("https://www.google.com") + print("Successfully opened Google!") + driver.quit() + ' > test_headless.py + + # 运行该测试脚本 + docker run --rm -v $PWD:/app memorycollection/iptv:latest python /app/test_headless.py + # 推送 Docker 镜像到 Docker Hub - name: Push Docker Image run: | docker push memorycollection/iptv:latest -