mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-19 18:08:35 +00:00
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:
44
build.sh
44
build.sh
@@ -4,13 +4,13 @@
|
||||
usage() {
|
||||
echo "Usage: $0 [-l] [-f <ftl_branch>] [-c <core_branch>] [-w <web_branch>] [-t <tag>] [use_cache]"
|
||||
echo "Options:"
|
||||
echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)"
|
||||
echo " -c, --corebranch <branch> Specify Core branch"
|
||||
echo " -w, --webbranch <branch> Specify Web branch"
|
||||
echo " -p, --paddbranch <branch> Specify PADD branch"
|
||||
echo " -t, --tag <tag> Specify Docker image tag (default: pihole:local)"
|
||||
echo " -l, --local Use locally built FTL binary (requires src/pihole-FTL file)"
|
||||
echo " use_cache Enable caching (by default --no-cache is used)"
|
||||
echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)"
|
||||
echo " -c, --corebranch <branch> Specify Core branch"
|
||||
echo " -w, --webbranch <branch> Specify Web branch"
|
||||
echo " -p, --paddbranch <branch> Specify PADD branch"
|
||||
echo " -t, --tag <tag> Specify Docker image tag (default: pihole:local)"
|
||||
echo " -l, --local Use locally built FTL binary (requires src/pihole-FTL file)"
|
||||
echo " use_cache Enable caching (by default --no-cache is used)"
|
||||
echo ""
|
||||
echo "If no options are specified, the following command will be executed:"
|
||||
echo " docker buildx build src/. --tag pihole:local --load --no-cache"
|
||||
@@ -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}
|
||||
|
||||
@@ -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 && \
|
||||
|
||||
Reference in New Issue
Block a user