From b4ea7d0ab59324f9f04c89041da581d2b193be30 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 23 Aug 2024 16:14:52 +0200 Subject: [PATCH] Implement custom version checks Many dependencies are installed manually within the Dockerfiles, where Renovate cannot determine the version numbers by default. However, through custom matching, the corresponding data sources can be invoked, and the version number replaced via regex. --- .renovaterc | 26 +++++++++++++++++++++- images/fava/Dockerfile | 4 +++- images/frp/Dockerfile | 1 + images/lua-clib/Dockerfile | 7 ++++-- images/nextcloud/Dockerfile | 32 ++++++++++++++------------- images/node-script/Dockerfile | 29 ++++++++++++++++++------ images/python-script/Dockerfile | 14 +++++++++--- images/python-script/requirements.txt | 8 +++++++ images/rust-xwin/Dockerfile | 2 ++ 9 files changed, 94 insertions(+), 29 deletions(-) create mode 100644 images/python-script/requirements.txt diff --git a/.renovaterc b/.renovaterc index b36f3b4..f3d58ed 100644 --- a/.renovaterc +++ b/.renovaterc @@ -7,5 +7,29 @@ ":rebaseStalePrs" ], "prConcurrentLimit": 10, - "branchPrefix": "renovate/" + "branchPrefix": "renovate/", + "customManagers": [ + { + "customType": "regex", + "description": "Update _VERSION variables in Dockerfiles", + "fileMatch": [ + "(^|/|\\.)Dockerfile$", + "(^|/)Dockerfile\\.[^/]*$" + ], + "matchStrings": [ + "# renovate: datasource=(?[a-z-]+?)(?: depName=(?.+?))? packageName=(?.+?)(?: versioning=(?[a-z-]+?))?\\s(?:ENV|ARG) .+?_VERSION=(?.+?)\\s" + ] + } + ], + "packageRules": [ + { + "matchDatasources": [ + "github-release" + ], + "matchPackageNames": [ + "llvm/llvm-project" + ], + "extractVersion": "^llvmorg-(?\\d+)\\.\\d+\\.\\d+$" + } + ] } diff --git a/images/fava/Dockerfile b/images/fava/Dockerfile index 4e2c60c..6c9b166 100644 --- a/images/fava/Dockerfile +++ b/images/fava/Dockerfile @@ -1,7 +1,9 @@ +# renovate: datasource=github-tags depName=beancount packageName=beancount/beancount ARG BEANCOUNT_VERSION=2.3.6 +# renovate: datasource=github-tags depName=fava packageName=beancount/fava ARG FAVA_VERSION=1.27.3 -FROM node:lts-slim as node_build_env +FROM node:20.17.0-slim as node_build_env ARG FAVA_VERSION RUN set -eux; \ diff --git a/images/frp/Dockerfile b/images/frp/Dockerfile index 47df792..6155f54 100644 --- a/images/frp/Dockerfile +++ b/images/frp/Dockerfile @@ -1,3 +1,4 @@ +# renovate: datasource=github-releases depName=frp packageName=fateder/frp ARG FRP_VERSION=0.60.0 FROM scratch AS src diff --git a/images/lua-clib/Dockerfile b/images/lua-clib/Dockerfile index 347ee26..dea5cd7 100644 --- a/images/lua-clib/Dockerfile +++ b/images/lua-clib/Dockerfile @@ -2,8 +2,11 @@ ARG LUA_5_1_VERSION=5.1.5 ARG LUA_5_2_VERSION=5.2.4 ARG LUA_5_3_VERSION=5.3.6 ARG LUA_5_4_VERSION=5.4.4 +# renovate: datasource=github-tags depName=luarocks packageName=luarocks/luarocks ARG LUAROCKS_VERSION=3.10.0 +# renovate: datasource=github-releases depName=dart-sass packageName=sass/dart-sass ARG DART_SASS_VERSION=1.71.1 +# renovate: datasource=github-tags depName=node packageName=nodejs/node ARG NODE_VERSION=20.11.1 FROM debian:bookworm-slim AS builder @@ -84,7 +87,7 @@ RUN set -e; \ make -j $(nproc); \ make install; -FROM builder AS dart +FROM builder AS sass ARG DART_SASS_VERSION ADD https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz /build/sass.tar.gz @@ -140,7 +143,7 @@ COPY --from=lua52 /usr/local /usr/local COPY --from=lua53 /usr/local /usr/local COPY --from=lua54 /usr/local /usr/local COPY --from=node /usr/local /usr/local -COPY --from=dart /usr/local /usr/local +COPY --from=sass /usr/local /usr/local RUN --mount=type=cache,target=/var/cache/luarocks \ set -e; \ diff --git a/images/nextcloud/Dockerfile b/images/nextcloud/Dockerfile index 6b54255..97969b9 100644 --- a/images/nextcloud/Dockerfile +++ b/images/nextcloud/Dockerfile @@ -1,27 +1,29 @@ FROM nextcloud:28.0.6-apache +# renovate: datasource=github-releases depName=yt-dlp packageName=yt-dlp/yt-dlp versioning=loose ARG YTDLP_VERSION=2024.05.27 # Debian ships node.js v18, make sure that the pageres version supports that +# renovate: datasource=npm packageName=pageres-cli ARG PAGERES_VERSION=8.0.0 RUN set -ex; \ apt-get update; \ apt-get install -y --no-install-recommends --no-install-suggests \ - aria2 \ - cifs-utils \ - clamav \ - ffmpeg \ - libnss3 \ - libbz2-dev \ - nodejs \ - npm \ - smbclient \ - p7zip \ - p7zip-full \ - python3-pip \ - unzip \ - wget \ - ; \ + aria2 \ + cifs-utils \ + clamav \ + ffmpeg \ + libnss3 \ + libbz2-dev \ + nodejs \ + npm \ + smbclient \ + p7zip \ + p7zip-full \ + python3-pip \ + unzip \ + wget \ + ; \ docker-php-ext-install bz2; \ npm install --global pageres-cli@${PAGERES_VERSION} puppeteer; \ npx puppeteer browsers install chrome; \ diff --git a/images/node-script/Dockerfile b/images/node-script/Dockerfile index 86d00cb..b46daa4 100644 --- a/images/node-script/Dockerfile +++ b/images/node-script/Dockerfile @@ -1,5 +1,20 @@ FROM node:20.17.0-slim +# renovate: datasource=npm packageName=npm +ARG NPM_VERSION=10.5.0 +# renovate: datasource=npm packageName=bluebird +ARG BLUEBIRD_VERSION=3.7.2 +# renovate: datasource=npm packageName=lodash +ARG LODASH_VERSION=4.17.21 +# renovate: datasource=npm packageName=moment +ARG MOMENT_VERSION=2.30.1 +# renovate: datasource=npm packageName=shelljs +ARG SHELLJS_VERSION=0.8.5 +# renovate: datasource=npm packageName=js-yaml +ARG JS_YAML_VERSION=4.1.0 +# renovate: datasource=npm packageName=got +ARG GOT_VERSION=14.4.2 + # No need for root access for a script runner RUN useradd -m -d /home/runner -s /bin/bash runner; WORKDIR /home/runner @@ -11,13 +26,13 @@ ENV PATH=/home/runner/.npm-global/bin:$PATH RUN set -e; \ npm install --global --audit=false \ - npm@10.5.0 \ - bluebird \ - lodash \ - moment \ - shelljs \ - js-yaml \ - got \ + npm@${NPM_VERSION} \ + bluebird@${BLUEBIRD_VERSION} \ + lodash@${LODASH_VERSION} \ + moment@${MOMENT_VERSION} \ + shelljs@${SHELLJS_VERSION} \ + js-yaml@${JS_YAML_VERSION} \ + got@${GOT_VERSION} \ ; \ rm -r \ /home/runner/.npm/_cacache \ diff --git a/images/python-script/Dockerfile b/images/python-script/Dockerfile index 8466be4..0111c67 100644 --- a/images/python-script/Dockerfile +++ b/images/python-script/Dockerfile @@ -1,6 +1,13 @@ FROM python:3.12.5-slim-bookworm -LABEL version=1.1.0 +ARG PIP_VERSION=24.2 +ARG NUMPY_VERSION=2.1.0 +ARG HTTPIE_VERSION=3.2.3 +ARG PYFROGEJO_VERSION=1.0.2 +ARG DOCKER_VERSION=7.1.0 +ARG XQ_VERSION=0.0.4 +ARG SPOTIFY_VERSION=0.10.2 +ARG REQUESTS_VERSION=2.32.2 RUN set -e; \ apt-get update -q; \ @@ -30,7 +37,8 @@ USER runner ENV PATH=/home/runner/.local/bin:$PATH +COPY requirements.txt ./ + RUN set -e; \ - pip install --upgrade pip; \ - pip install --user numpy httpie giteapy docker xq yp spotify requests; \ + pip install --user -r requirements.txt; \ rm -r /home/runner/.cache; diff --git a/images/python-script/requirements.txt b/images/python-script/requirements.txt new file mode 100644 index 0000000..88239ac --- /dev/null +++ b/images/python-script/requirements.txt @@ -0,0 +1,8 @@ +pip +numpy +httpie +pyforgejo +requests +spotify +xq +docker diff --git a/images/rust-xwin/Dockerfile b/images/rust-xwin/Dockerfile index aadd9d6..2164875 100644 --- a/images/rust-xwin/Dockerfile +++ b/images/rust-xwin/Dockerfile @@ -2,6 +2,7 @@ FROM debian:bullseye-slim AS xwin-download ARG MANIFEST_VERSION=16 +# renovate: datasource=github-releases depName=xwin packageName=Jake-Shadle/xwin ARG XWIN_VERSION=0.6.5 ARG XWIN_PREFIX="xwin-$XWIN_VERSION-x86_64-unknown-linux-musl" ADD https://github.com/Jake-Shadle/xwin/releases/download/$XWIN_VERSION/$XWIN_PREFIX.tar.gz /root/$XWIN_PREFIX.tar.gz @@ -27,6 +28,7 @@ RUN set -eux; \ FROM rust:slim-bullseye AS rust-xwin +# renovate: datasource=github-releases depName=llvm packageName=llvm/llvm-project ARG LLVM_VERSION=18 ENV KEYRINGS=/usr/local/share/keyrings