Allow for building the image against a fork of the core/web/padd repos - leave FTL for now.

Undocumented as it's only really for internal use when testing contributor PRs for the core/web/padd repos.
This commit is contained in:
Adam Warner
2025-05-30 23:10:21 +01:00
parent 28641b7909
commit 2a656e68df
2 changed files with 40 additions and 14 deletions

View File

@@ -21,6 +21,9 @@ usage() {
TAG="pihole:local"
DOCKER_BUILD_CMD="docker buildx build src/. --tag ${TAG} --load --no-cache"
FTL_FLAG=false
CORE_FORK="pi-hole"
WEB_FORK="pi-hole"
PADD_FORK="pi-hole"
# Check if buildx is installed
docker buildx version >/dev/null 2>&1
@@ -34,13 +37,14 @@ fi
check_branch_exists() {
local repo=$1
local branch=$2
local fork=$3
local url
if [ "$repo" == "ftl" ]; then
# Special case for FTL - we check for the binary instead of just the branch - in case it is not yet built.
url="https://ftl.pi-hole.net/${branch}/pihole-FTL-amd64"
else
url="https://github.com/pi-hole/${repo}/blob/${branch}/README.md"
url="https://github.com/${fork}/${repo}/blob/${branch}/README.md"
fi
local http_code
@@ -83,14 +87,14 @@ while [[ $# -gt 0 ]]; do
;;
-c | --corebranch)
CORE_BRANCH="$2"
check_branch_exists "pi-hole" "$CORE_BRANCH"
check_branch_exists "pi-hole" "$CORE_BRANCH" "$CORE_FORK"
DOCKER_BUILD_CMD+=" --build-arg CORE_BRANCH=$CORE_BRANCH"
shift
shift
;;
-w | --webbranch)
WEB_BRANCH="$2"
check_branch_exists "web" "$WEB_BRANCH"
check_branch_exists "web" "$WEB_BRANCH" "$WEB_FORK"
DOCKER_BUILD_CMD+=" --build-arg WEB_BRANCH=$WEB_BRANCH"
shift
shift
@@ -102,6 +106,24 @@ while [[ $# -gt 0 ]]; do
shift
shift
;;
-cf | --corefork)
CORE_FORK="$2"
DOCKER_BUILD_CMD+=" --build-arg CORE_FORK=$CORE_FORK"
shift
shift
;;
-wf | --webfork)
WEB_FORK="$2"
DOCKER_BUILD_CMD+=" --build-arg WEB_FORK=$WEB_FORK"
shift
shift
;;
-pf | --paddfork)
PADD_FORK="$2"
DOCKER_BUILD_CMD+=" --build-arg PADD_FORK=$PADD_FORK"
shift
shift
;;
-t | --tag)
CUSTOM_TAG="$2"
DOCKER_BUILD_CMD=${DOCKER_BUILD_CMD/$TAG/$CUSTOM_TAG}

View File

@@ -11,6 +11,10 @@ ARG FTL_BRANCH="development"
ARG PIHOLE_DOCKER_TAG="dev-localbuild"
ARG PADD_BRANCH="development"
ARG CORE_FORK="pi-hole"
ARG WEB_FORK="pi-hole"
ARG PADD_FORK="pi-hole"
ARG PIHOLE_UID=1000
ARG PIHOLE_GID=1000
@@ -55,11 +59,11 @@ ADD https://ftl.pi-hole.net/macvendor.db /macvendor.db
COPY crontab.txt /crontab.txt
# Add PADD to the container, too.
ADD --chmod=0755 https://raw.githubusercontent.com/pi-hole/PADD/${PADD_BRANCH}/padd.sh /usr/local/bin/padd
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
RUN git clone --depth 1 --single-branch --branch ${WEB_BRANCH} https://github.com/pi-hole/web.git /var/www/html/admin && \
git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/pi-hole/pi-hole.git /etc/.pihole
RUN git clone --depth 1 --single-branch --branch ${WEB_BRANCH} https://github.com/${WEB_FORK}/web.git /var/www/html/admin && \
git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole
RUN cd /etc/.pihole && \
install -Dm755 -d /opt/pihole && \