From e109c1e1906fd5bf9befe7f6b2bbae2853d6ed33 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 2 Nov 2022 22:45:39 +0100 Subject: [PATCH] Revert "Docker & python - Use pip conditional requirements to not install playwright for ARM (unsupported on ARM) (#1067)" This reverts commit c93ca1841cad6f7dc1723b96cbeed924309c5dc1. --- Dockerfile | 5 +++++ changedetectionio/run_all_tests.sh | 4 ++++ requirements.txt | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) 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