From 1ac70a16a0e0442371c71c893b467c006a160aff Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 1 Jun 2025 01:56:18 -0400 Subject: [PATCH 1/9] Enable `editor` in the container For less than 3 MiB, I can have a modern editor that does enough of what `vim-nox` does that zi won't miss that. --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index da1e84c5..aba92a07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -321,6 +321,8 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va apt-get -y autoclean && \ rm -v -f /var/cache/debconf/*.dat-old +# The preference for openresty over nginx, +# is for the newer version. FROM tubesync-openresty AS tubesync ARG S6_VERSION @@ -352,7 +354,12 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va python3-pip-whl \ python3-socks \ curl \ + indent \ less \ + lua-lpeg \ + tre-agrep \ + vis \ + xxd \ && \ # Link to the current python3 version ln -v -s -f -T "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" /usr/local/lib/python3 && \ From 89abf8f56875c898de15d5fdb16c7f7018b041ae Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 1 Jun 2025 02:01:02 -0400 Subject: [PATCH 2/9] Add `babi` editor --- Pipfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Pipfile b/Pipfile index 49b5127b..34a52aa8 100644 --- a/Pipfile +++ b/Pipfile @@ -25,3 +25,4 @@ emoji = "*" brotli = "*" html5lib = "*" bgutil-ytdlp-pot-provider = "*" +babi = "*" From e5c19a2c47984af152e5ffa60d336064b8a3a2ec Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 1 Jun 2025 12:39:10 -0400 Subject: [PATCH 3/9] Configure alternatives groups --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aba92a07..735c10eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -362,7 +362,14 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va xxd \ && \ # Link to the current python3 version - ln -v -s -f -T "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" /usr/local/lib/python3 && \ + update-alternatives --install /usr/local/lib/python3 python3-lib \ + "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" 100 && \ + # Configure the editor and nano alternatives + touch /usr/local/bin/babi /bin/nano && \ + update-alternatives --install /usr/local/bin/nano nano /bin/nano 10 && \ + update-alternatives --install /usr/local/bin/nano nano /usr/local/bin/babi 20 && \ + update-alternatives --install /usr/bin/editor editor /usr/local/bin/babi 50 && \ + rm -v /usr/local/bin/babi /bin/nano && \ # Create a 'app' user which the application will run as groupadd app && \ useradd -M -d /app -s /bin/false -g app app && \ From c1e30b775117d6046dfec32853358c08e84c7d76 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 1 Jun 2025 12:57:21 -0400 Subject: [PATCH 4/9] Add the `vim` alternatives group --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 735c10eb..d2df5d67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -364,12 +364,14 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va # Link to the current python3 version update-alternatives --install /usr/local/lib/python3 python3-lib \ "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" 100 && \ - # Configure the editor and nano alternatives - touch /usr/local/bin/babi /bin/nano && \ + # Configure the editor alternatives + touch /usr/local/bin/babi /bin/nano /usr/bin/vim.tiny && \ + update-alternatives --install /usr/bin/editor editor /usr/local/bin/babi 50 && \ update-alternatives --install /usr/local/bin/nano nano /bin/nano 10 && \ update-alternatives --install /usr/local/bin/nano nano /usr/local/bin/babi 20 && \ - update-alternatives --install /usr/bin/editor editor /usr/local/bin/babi 50 && \ - rm -v /usr/local/bin/babi /bin/nano && \ + update-alternatives --install /usr/local/bin/vim vim /usr/bin/vim.tiny 15 && \ + rm -v /usr/local/bin/babi /bin/nano /usr/bin/vim.tiny && \ + update-alternatives --install /usr/local/bin/vim vim /usr/bin/vis 35 && \ # Create a 'app' user which the application will run as groupadd app && \ useradd -M -d /app -s /bin/false -g app app && \ From 8b0d3ebd30b323648ff14d72d8bc517ee5a305b0 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 1 Jun 2025 13:00:21 -0400 Subject: [PATCH 5/9] Set the `EDITOR` environment variable to use the alternatives group --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index d2df5d67..022a2b7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,7 @@ ARG TARGETARCH ENV DEBIAN_FRONTEND="noninteractive" \ APT_KEEP_ARCHIVES=1 \ + EDITOR="editor" \ HOME="/root" \ LANGUAGE="en_US.UTF-8" \ LANG="en_US.UTF-8" \ From 133d65a6c98b02685b966ca51384b72c1f9cdfe4 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 1 Jun 2025 13:04:18 -0400 Subject: [PATCH 6/9] Prevent `update-alternatives` from doing the wrong thing --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 022a2b7b..7ad61039 100644 --- a/Dockerfile +++ b/Dockerfile @@ -371,8 +371,8 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va update-alternatives --install /usr/local/bin/nano nano /bin/nano 10 && \ update-alternatives --install /usr/local/bin/nano nano /usr/local/bin/babi 20 && \ update-alternatives --install /usr/local/bin/vim vim /usr/bin/vim.tiny 15 && \ - rm -v /usr/local/bin/babi /bin/nano /usr/bin/vim.tiny && \ update-alternatives --install /usr/local/bin/vim vim /usr/bin/vis 35 && \ + rm -v /usr/local/bin/babi /bin/nano /usr/bin/vim.tiny && \ # Create a 'app' user which the application will run as groupadd app && \ useradd -M -d /app -s /bin/false -g app app && \ From 3fc2b09a26f6cfa69630863e00b39e262684b75f Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 3 Jun 2025 09:56:15 -0400 Subject: [PATCH 7/9] Remove the `python3-lib` alternative --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7ad61039..ffc08066 100644 --- a/Dockerfile +++ b/Dockerfile @@ -363,8 +363,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va xxd \ && \ # Link to the current python3 version - update-alternatives --install /usr/local/lib/python3 python3-lib \ - "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" 100 && \ + ln -v -s -f -T "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" /usr/local/lib/python3 && \ # Configure the editor alternatives touch /usr/local/bin/babi /bin/nano /usr/bin/vim.tiny && \ update-alternatives --install /usr/bin/editor editor /usr/local/bin/babi 50 && \ From f74c22c849a216cc807a97e2d3930349e6044133 Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 3 Jun 2025 10:32:28 -0400 Subject: [PATCH 8/9] fixup: building from source on arm64 --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ffc08066..2dee66ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -423,6 +423,7 @@ RUN --mount=type=tmpfs,target=/cache \ g++ \ gcc \ libjpeg-dev \ + libonig-dev \ libpq-dev \ libwebp-dev \ make \ @@ -466,6 +467,7 @@ RUN --mount=type=tmpfs,target=/cache \ g++ \ gcc \ libjpeg-dev \ + libonig-dev \ libpq-dev \ libwebp-dev \ make \ From a849367ac86dc75955dc1396f6647941fe6c3ad1 Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 3 Jun 2025 10:48:17 -0400 Subject: [PATCH 9/9] Add the library `libonig-dev` depends upon also --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 2dee66ac..2a95f304 100644 --- a/Dockerfile +++ b/Dockerfile @@ -347,6 +347,7 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va apt-get -y --no-install-recommends install \ libjpeg62-turbo \ libmariadb3 \ + libonig5 \ libpq5 \ libwebp7 \ pkgconf \