kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Playwright extension added back to Dockerfile to resolve conditional fix Alpine (musl) based systems (#1087)
rodzic
defc7a340e
commit
3416532cd6
|
@ -0,0 +1,31 @@
|
||||||
|
# Taken from https://github.com/linuxserver/docker-changedetection.io/blob/main/Dockerfile
|
||||||
|
# Test that we can still build on Alpine (musl modified libc https://musl.libc.org/)
|
||||||
|
# Some packages wont install via pypi because they dont have a wheel available under this architecture.
|
||||||
|
|
||||||
|
FROM ghcr.io/linuxserver/baseimage-alpine:3.16
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
COPY requirements.txt /requirements.txt
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
apk add --update --no-cache --virtual=build-dependencies \
|
||||||
|
cargo \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-dev \
|
||||||
|
libffi-dev \
|
||||||
|
libxslt-dev \
|
||||||
|
make \
|
||||||
|
openssl-dev \
|
||||||
|
py3-wheel \
|
||||||
|
python3-dev \
|
||||||
|
zlib-dev && \
|
||||||
|
apk add --update --no-cache \
|
||||||
|
libxslt \
|
||||||
|
python3 \
|
||||||
|
py3-pip && \
|
||||||
|
echo "**** pip3 install test of changedetection.io ****" && \
|
||||||
|
pip3 install -U pip wheel setuptools && \
|
||||||
|
pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.16/ -r /requirements.txt && \
|
||||||
|
apk del --purge \
|
||||||
|
build-dependencies
|
|
@ -43,6 +43,16 @@ jobs:
|
||||||
version: latest
|
version: latest
|
||||||
driver-opts: image=moby/buildkit:master
|
driver-opts: image=moby/buildkit:master
|
||||||
|
|
||||||
|
# https://github.com/dgtlmoon/changedetection.io/pull/1067
|
||||||
|
# Check we can still build under alpine/musl
|
||||||
|
- name: Test that the docker containers can build (musl via alpine check)
|
||||||
|
id: docker_build_musl
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
file: ./.github/test/Dockerfile-alpine
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
- name: Test that the docker containers can build
|
- name: Test that the docker containers can build
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
|
@ -53,3 +63,4 @@ jobs:
|
||||||
platforms: linux/arm/v7,linux/arm/v6,linux/amd64,linux/arm64,
|
platforms: linux/arm/v7,linux/arm/v6,linux/amd64,linux/arm64,
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@ COPY requirements.txt /requirements.txt
|
||||||
|
|
||||||
RUN pip install --target=/dependencies -r /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
|
# Final image stage
|
||||||
FROM python:3.8-slim
|
FROM python:3.8-slim
|
||||||
|
|
|
@ -38,6 +38,10 @@ unset WEBDRIVER_URL
|
||||||
docker kill $$-test_selenium
|
docker kill $$-test_selenium
|
||||||
|
|
||||||
echo "TESTING WEBDRIVER FETCH > PLAYWRIGHT/BROWSERLESS..."
|
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
|
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
|
# takes a while to spin up
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
|
@ -52,7 +52,7 @@ jinja2-time
|
||||||
|
|
||||||
# https://peps.python.org/pep-0508/#environment-markers
|
# https://peps.python.org/pep-0508/#environment-markers
|
||||||
# https://github.com/dgtlmoon/changedetection.io/pull/1009
|
# https://github.com/dgtlmoon/changedetection.io/pull/1009
|
||||||
jq ~= 1.3 ;python_version >= "3.8" and sys_platform == "linux"
|
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
|
|
||||||
|
|
||||||
|
# playwright is installed at Dockerfile build time because it's not available on all platforms
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue