diff --git a/Dockerfile b/Dockerfile index d16736fa..a88ab5a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,11 @@ COPY requirements.txt /requirements.txt RUN pip install --target=/dependencies -r /requirements.txt +# Playwright is an alternative to Selenium +# Excluded this package from requirements.txt to prevent arm/v6 and arm/v7 builds from failing +# https://github.com/dgtlmoon/changedetection.io/pull/1067 also musl/alpine (not supported) +RUN pip install --target=/dependencies playwright~=1.26 \ + || echo "WARN: Failed to install Playwright. The application can still run, but the Playwright option will be disabled." # Final image stage FROM python:3.8-slim diff --git a/changedetectionio/run_all_tests.sh b/changedetectionio/run_all_tests.sh index 2783c9b8..459513e8 100755 --- a/changedetectionio/run_all_tests.sh +++ b/changedetectionio/run_all_tests.sh @@ -38,6 +38,10 @@ unset WEBDRIVER_URL docker kill $$-test_selenium echo "TESTING WEBDRIVER FETCH > PLAYWRIGHT/BROWSERLESS..." +# Not all platforms support playwright (not ARM/rPI), so it's not packaged in requirements.txt +PLAYWRIGHT_VERSION=$(grep -i -E "RUN pip install.+" "$SCRIPT_DIR/../Dockerfile" | grep --only-matching -i -E "playwright[=><~+]+[0-9\.]+") +echo "using $PLAYWRIGHT_VERSION" +pip3 install "$PLAYWRIGHT_VERSION" docker run -d --name $$-test_browserless -e "DEFAULT_LAUNCH_ARGS=[\"--window-size=1920,1080\"]" --rm -p 3000:3000 --shm-size="2g" browserless/chrome:1.53-chrome-stable # takes a while to spin up sleep 5 diff --git a/requirements.txt b/requirements.txt index 48398276..fd5b23bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -52,7 +52,7 @@ jinja2-time # https://peps.python.org/pep-0508/#environment-markers # https://github.com/dgtlmoon/changedetection.io/pull/1009 -jq ~= 1.3 ;python_version >= "3.8" and sys_platform == "linux" -playwright~=1.26; python_version >= "3.8" and "arm" not in platform_machine and "aarch" not in platform_machine +jq~=1.3 ;python_version >= "3.8" and sys_platform == "linux" +# playwright is installed at Dockerfile build time because it's not available on all platforms