From a0203372ce26b5d7aafd0af53a5c45a183eceecf Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 24 Jul 2023 17:04:50 +0800 Subject: [PATCH] Built-in nscd into the docker image (a better dns caching service) (#3472) --- docker/debian-base.dockerfile | 32 ++++++++++--- docker/etc/nscd.conf | 90 +++++++++++++++++++++++++++++++++++ docker/etc/sudoers | 31 ++++++++++++ server/server.js | 3 ++ server/uptime-kuma-server.js | 43 ++++++++++++++++- 5 files changed, 192 insertions(+), 7 deletions(-) create mode 100644 docker/etc/nscd.conf create mode 100644 docker/etc/sudoers diff --git a/docker/debian-base.dockerfile b/docker/debian-base.dockerfile index fd57cf91..244e6c5f 100644 --- a/docker/debian-base.dockerfile +++ b/docker/debian-base.dockerfile @@ -5,13 +5,29 @@ ARG TARGETPLATFORM WORKDIR /app -# Install Curl -# Install Apprise, add sqlite3 cli for debugging in the future, iputils-ping for ping, util-linux for setpriv -# Stupid python3 and python3-pip actually install a lot of useless things into Debian, specify --no-install-recommends to skip them, make the base even smaller than alpine! +# Specify --no-install-recommends to skip unused dependencies, make the base much smaller! +# python3* = apprise's dependencies +# sqlite3 = for debugging +# iputils-ping = for ping +# util-linux = for setpriv (Should be dropped in 2.0.0?) +# dumb-init = avoid zombie processes (#480) +# curl = for debugging +# ca-certificates = keep the cert up-to-date +# sudo = for start service nscd with non-root user +# nscd = for better DNS caching +# (pip) apprise = for notifications RUN apt-get update && \ - apt-get --yes --no-install-recommends install python3 python3-pip python3-cryptography python3-six python3-yaml python3-click python3-markdown python3-requests python3-requests-oauthlib \ - sqlite3 iputils-ping util-linux dumb-init git curl ca-certificates && \ - pip3 --no-cache-dir install apprise==1.4.0 && \ + apt-get --yes --no-install-recommends install \ + python3 python3-pip python3-cryptography python3-six python3-yaml python3-click python3-markdown python3-requests python3-requests-oauthlib \ + sqlite3 \ + iputils-ping \ + util-linux \ + dumb-init \ + curl \ + ca-certificates \ + sudo \ + nscd && \ + pip3 --no-cache-dir install apprise==1.4.5 && \ rm -rf /var/lib/apt/lists/* && \ apt --yes autoremove @@ -26,3 +42,7 @@ RUN set -eux && \ rm -rf /var/lib/apt/lists/* && \ apt --yes autoremove +# For nscd +COPY ./docker/etc/nscd.conf /etc/nscd.conf +COPY ./docker/etc/sudoers /etc/sudoers + diff --git a/docker/etc/nscd.conf b/docker/etc/nscd.conf new file mode 100644 index 00000000..18b92bfe --- /dev/null +++ b/docker/etc/nscd.conf @@ -0,0 +1,90 @@ +# +# /etc/nscd.conf +# +# An example Name Service Cache config file. This file is needed by nscd. +# +# Legal entries are: +# +# logfile +# debug-level +# threads +# max-threads +# server-user +# server-user is ignored if nscd is started with -S parameters +# stat-user +# reload-count unlimited| +# paranoia +# restart-interval