Rebase to 3.21, support non-root operation

This commit is contained in:
thespad 2024-12-19 14:58:53 +00:00
parent 2f06ebab1b
commit fe34eff06f
No known key found for this signature in database
6 changed files with 30 additions and 13 deletions

View File

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine:3.20
FROM ghcr.io/linuxserver/baseimage-alpine:3.21
ARG BUILD_DATE
ARG VERSION
@ -47,7 +47,7 @@ RUN \
pip \
setuptools \
wheel && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20/ -r /app/changedetection/requirements.txt && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.21/ -r /app/changedetection/requirements.txt && \
PLAYWRIGHT_PY_RELEASE=$(curl -sX GET "https://api.github.com/repos/microsoft/playwright-python/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
git clone --depth 1 --branch "${PLAYWRIGHT_PY_RELEASE}" https://github.com/microsoft/playwright-python /tmp/playwright-python && \
@ -55,6 +55,8 @@ RUN \
pip install -U --no-cache-dir . && \
rm -f /lsiopy/lib/python3.12/site-packages/playwright/driver/node && \
ln -s /usr/bin/node /lsiopy/lib/python3.12/site-packages/playwright/driver/node && \
# Force UTF-8 encoding for browser steps to prevent exception
sed -i "s|xpath_element_js = importlib.resources.files(\"changedetectionio.content_fetchers.res\").joinpath('xpath_element_scraper.js').read_text()|xpath_element_js = importlib.resources.files(\"changedetectionio.content_fetchers.res\").joinpath('xpath_element_scraper.js').read_text(encoding='utf-8')|" /app/changedetection/changedetectionio/blueprint/browser_steps/browser_steps.py && \
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
echo "**** cleanup ****" && \
apk del --purge \

View File

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.20
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.21
ARG BUILD_DATE
ARG VERSION
@ -47,7 +47,7 @@ RUN \
pip \
setuptools \
wheel && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20/ -r /app/changedetection/requirements.txt && \
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.21/ -r /app/changedetection/requirements.txt && \
echo "**** install playwright ****" && \
PLAYWRIGHT_PY_RELEASE=$(curl -sX GET "https://api.github.com/repos/microsoft/playwright-python/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
@ -56,6 +56,8 @@ RUN \
pip install -U --no-cache-dir . && \
rm -f /lsiopy/lib/python3.12/site-packages/playwright/driver/node && \
ln -s /usr/bin/node /lsiopy/lib/python3.12/site-packages/playwright/driver/node && \
# Force UTF-8 encoding for browser steps to prevent exception
sed -i "s|xpath_element_js = importlib.resources.files(\"changedetectionio.content_fetchers.res\").joinpath('xpath_element_scraper.js').read_text()|xpath_element_js = importlib.resources.files(\"changedetectionio.content_fetchers.res\").joinpath('xpath_element_scraper.js').read_text(encoding='utf-8')|" /app/changedetection/changedetectionio/blueprint/browser_steps/browser_steps.py && \
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
echo "**** cleanup ****" && \
apk del --purge \

View File

@ -69,6 +69,10 @@ For more info read [the wiki](https://github.com/dgtlmoon/changedetection.io/wik
This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/).
## Non-Root Operation
This image can be run with a non-root user. For details please [read the docs](https://docs.linuxserver.io/misc/non-root/).
## Usage
To help you get started creating a container from this image you can either use docker-compose or the docker cli.
@ -127,6 +131,7 @@ Containers are configured using parameters passed at runtime (such as those abov
| `-e PLAYWRIGHT_DRIVER_URL=` | Specify the full URL to your chrome driver instance. See the [wiki](https://github.com/dgtlmoon/changedetection.io/wiki/Playwright-content-fetcher) for details. |
| `-v /config` | Persistent config files |
| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). |
| `--user=1000:1000` | Run container with a non-root user. Please [read the docs](https://docs.linuxserver.io/misc/non-root/). |
## Environment variables from files (Docker secrets)
@ -290,6 +295,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **19.12.24:** - Rebase to Alpine 3.21.
* **31.05.24:** - Rebase to Alpine 3.20.
* **09.03.24:** - Build Playwright from source because Microsoft's build and packaging process is awful.
* **08.03.24:** - Build Playwright-python from source, add libjpeg.

View File

@ -19,7 +19,6 @@ param_volumes:
param_usage_include_ports: true
param_ports:
- {external_port: "5000", internal_port: "5000", port_desc: "WebUI"}
readonly_supported: true
# optional container parameters
opt_param_usage_include_env: true
opt_param_env_vars:
@ -42,6 +41,8 @@ custom_compose: |
ports:
- 5000:5000
restart: unless-stopped
readonly_supported: true
nonroot_supported: true
# application setup block
app_setup_block_enabled: true
app_setup_block: |
@ -95,6 +96,7 @@ init_diagram: |
"changedetection.io:latest" <- Base Images
# changelog
changelogs:
- {date: "19.12.24:", desc: "Rebase to Alpine 3.21."}
- {date: "31.05.24:", desc: "Rebase to Alpine 3.20."}
- {date: "09.03.24:", desc: "Build Playwright from source because Microsoft's build and packaging process is awful."}
- {date: "08.03.24:", desc: "Build Playwright-python from source, add libjpeg."}

View File

@ -1,8 +1,7 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# Force UTF-8 encoding for browser steps to prevent exception
sed -i "s|xpath_element_js = importlib.resources.files(\"changedetectionio.content_fetchers.res\").joinpath('xpath_element_scraper.js').read_text()|xpath_element_js = importlib.resources.files(\"changedetectionio.content_fetchers.res\").joinpath('xpath_element_scraper.js').read_text(encoding='utf-8')|" /app/changedetection/changedetectionio/blueprint/browser_steps/browser_steps.py
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
lsiown -R abc:abc \
/config \
/config
fi

View File

@ -1,6 +1,12 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 5000" \
cd /app/changedetection s6-setuidgid abc python3 /app/changedetection/changedetection.py -d /config
else
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 5000" \
cd /app/changedetection python3 /app/changedetection/changedetection.py -d /config
fi