Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase to 3.21, support non-root operation #26

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -47,14 +47,16 @@ 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 && \
cd /tmp/playwright-python && \
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 \
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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='[""]'); \
Expand All @@ -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 \
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: |
Expand Down Expand Up @@ -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."}
Expand Down
9 changes: 4 additions & 5 deletions root/etc/s6-overlay/s6-rc.d/init-changedetection-config/run
Original file line number Diff line number Diff line change
@@ -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

lsiown -R abc:abc \
/config \
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
lsiown -R abc:abc \
/config
fi
12 changes: 9 additions & 3 deletions root/etc/s6-overlay/s6-rc.d/svc-changedetection/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

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
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
Loading