From b6ab417692d8df66d1ab083e0b06f00858058d78 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Wed, 16 Jul 2025 08:26:01 +0200 Subject: [PATCH 1/5] Only clone depth 1 when checking out tags Signed-off-by: yubiuser --- src/Dockerfile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 26ddcae..310efbc 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -61,11 +61,22 @@ COPY crontab.txt /crontab.txt ADD --chmod=0755 https://raw.githubusercontent.com/${PADD_FORK}/PADD/${PADD_BRANCH}/padd.sh /usr/local/bin/padd # download a the main repos from github -#if the branch is master we reset to the latest tag as sometimes the master branch contains meta changes that have not been tagged. -RUN git clone --depth 5 --single-branch --branch ${WEB_BRANCH} https://github.com/${WEB_FORK}/web.git /var/www/html/admin && \ - if [ "${WEB_BRANCH}" = "master" ]; then cd /var/www/html/admin && git reset --hard "$(git describe --tags --abbrev=0)"; fi && \ - git clone --depth 5 --single-branch --branch ${CORE_BRANCH} https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole && \ - if [ "${CORE_BRANCH}" = "master" ]; then cd /etc/.pihole && git reset --hard "$(git describe --tags --abbrev=0)"; fi +# if the branch is master we clone the latest as sometimes the master branch contains meta changes that have not been tagged +# (we need to create a new "master" branch to avoid the "detached HEAD" state for the version check to work correctly) +RUN if [ "${WEB_BRANCH}" = "master" ]; then \ + LATEST_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/${WEB_FORK}/web.git | tail -n1 | sed 's/.*\///; s/\^{}//') && \ + git clone --branch ${LATEST_TAG} --single-branch --depth 1 https://github.com/${WEB_FORK}/web.git /var/www/html/admin && \ + cd /var/www/html/admin && \ + git checkout -b master; \ + else git clone --depth 1 --single-branch --branch ${WEB_BRANCH} https://github.com/${WEB_FORK}/web.git /var/www/html/admin; fi + +RUN if [ "${CORE_BRANCH}" = "master" ]; then \ + LATEST_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/${CORE_FORK}/pi-hole.git | tail -n1 | sed 's/.*\///; s/\^{}//') && \ + git clone --branch ${LATEST_TAG} --single-branch --depth 1 https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole && \ + cd /etc/.pihole && \ + git checkout -b master; \ + else git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole; fi + RUN cd /etc/.pihole && \ install -Dm755 -d /opt/pihole && \ From 92429e3c50122f9d8275494df3ead73ed2f29a42 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Wed, 16 Jul 2025 09:18:56 +0200 Subject: [PATCH 2/5] Remove ncat dependency Signed-off-by: yubiuser --- src/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Dockerfile b/src/Dockerfile index 26ddcae..cada9d0 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -35,7 +35,6 @@ RUN apk add --no-cache \ libcap \ logrotate \ ncurses \ - nmap-ncat \ procps-ng \ psmisc \ shadow \ From 3b502683b8ae5297c6d718a22f4644fbae16cf31 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Mon, 21 Jul 2025 13:56:32 +0200 Subject: [PATCH 3/5] Use a function to reduce code duplication Signed-off-by: yubiuser --- src/Dockerfile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 310efbc..31ba079 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -61,21 +61,24 @@ COPY crontab.txt /crontab.txt ADD --chmod=0755 https://raw.githubusercontent.com/${PADD_FORK}/PADD/${PADD_BRANCH}/padd.sh /usr/local/bin/padd # download a the main repos from github -# if the branch is master we clone the latest as sometimes the master branch contains meta changes that have not been tagged +# if the branch is master we clone the latest tag as sometimes the master branch contains meta changes that have not been tagged # (we need to create a new "master" branch to avoid the "detached HEAD" state for the version check to work correctly) -RUN if [ "${WEB_BRANCH}" = "master" ]; then \ - LATEST_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/${WEB_FORK}/web.git | tail -n1 | sed 's/.*\///; s/\^{}//') && \ - git clone --branch ${LATEST_TAG} --single-branch --depth 1 https://github.com/${WEB_FORK}/web.git /var/www/html/admin && \ - cd /var/www/html/admin && \ - git checkout -b master; \ - else git clone --depth 1 --single-branch --branch ${WEB_BRANCH} https://github.com/${WEB_FORK}/web.git /var/www/html/admin; fi -RUN if [ "${CORE_BRANCH}" = "master" ]; then \ - LATEST_TAG=$(git ls-remote --tags --sort="v:refname" https://github.com/${CORE_FORK}/pi-hole.git | tail -n1 | sed 's/.*\///; s/\^{}//') && \ - git clone --branch ${LATEST_TAG} --single-branch --depth 1 https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole && \ - cd /etc/.pihole && \ - git checkout -b master; \ - else git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole; fi +RUN clone_repo() { \ + REPO_FORK="$1"; \ + REPO_NAME="$2"; \ + BRANCH="$3"; \ + DEST="$4"; \ + CLONE_BRANCH="$BRANCH"; \ + if [ "$BRANCH" = "master" ]; then \ + CLONE_BRANCH=$(curl -s https://api.github.com/repos/${REPO_FORK}/${REPO_NAME}/releases/latest | jq -r .tag_name); \ + fi; \ + git clone --branch "$CLONE_BRANCH" --single-branch --depth 1 "https://github.com/${REPO_FORK}/${REPO_NAME}.git" "$DEST"; \ + cd "$DEST"; \ + if [ "$BRANCH" = "master" ]; then git checkout -b master; fi; \ + }; \ + clone_repo "${WEB_FORK}" "web" "${WEB_BRANCH}" "/var/www/html/admin"; \ + clone_repo "${CORE_FORK}" "pi-hole" "${CORE_BRANCH}" "/etc/.pihole" RUN cd /etc/.pihole && \ From 0023474a325f538a4ee42b2c67fc5920b84f9f36 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Mon, 21 Jul 2025 14:01:14 +0200 Subject: [PATCH 4/5] Simplify variable names Signed-off-by: yubiuser --- src/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 31ba079..b378a46 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -65,15 +65,15 @@ ADD --chmod=0755 https://raw.githubusercontent.com/${PADD_FORK}/PADD/${PADD_BRAN # (we need to create a new "master" branch to avoid the "detached HEAD" state for the version check to work correctly) RUN clone_repo() { \ - REPO_FORK="$1"; \ - REPO_NAME="$2"; \ + FORK="$1"; \ + REPO="$2"; \ BRANCH="$3"; \ DEST="$4"; \ CLONE_BRANCH="$BRANCH"; \ if [ "$BRANCH" = "master" ]; then \ - CLONE_BRANCH=$(curl -s https://api.github.com/repos/${REPO_FORK}/${REPO_NAME}/releases/latest | jq -r .tag_name); \ + CLONE_BRANCH=$(curl -s https://api.github.com/repos/${FORK}/${REPO}/releases/latest | jq -r .tag_name); \ fi; \ - git clone --branch "$CLONE_BRANCH" --single-branch --depth 1 "https://github.com/${REPO_FORK}/${REPO_NAME}.git" "$DEST"; \ + git clone --branch "$CLONE_BRANCH" --single-branch --depth 1 "https://github.com/${FORK}/${REPO}.git" "$DEST"; \ cd "$DEST"; \ if [ "$BRANCH" = "master" ]; then git checkout -b master; fi; \ }; \ From 39bb4d4c61ec20fa0f00ea9494c030f425bc84ef Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Mon, 21 Jul 2025 15:21:52 -0300 Subject: [PATCH 5/5] Add link to "Changed Environment Variables" Signed-off-by: RD WebDesign --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bee7aac..9e9b07e 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ > > **Pi-hole v6 has been entirely redesigned from the ground up and contains many breaking changes.** > -> Environment variable names have changed, script locations may have changed. +> [Environment variable names have changed](https://docs.pi-hole.net/docker/upgrading/v5-v6/), script locations may have changed. > > If you are using volumes to persist your configuration, be careful.
Replacing any `v5` image *(`2024.07.0` and earlier)* with a `v6` image will result in updated configuration files. **These changes are irreversible**. >