mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-20 02:18:51 +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:
28
build.sh
28
build.sh
@@ -21,6 +21,9 @@ usage() {
|
|||||||
TAG="pihole:local"
|
TAG="pihole:local"
|
||||||
DOCKER_BUILD_CMD="docker buildx build src/. --tag ${TAG} --load --no-cache"
|
DOCKER_BUILD_CMD="docker buildx build src/. --tag ${TAG} --load --no-cache"
|
||||||
FTL_FLAG=false
|
FTL_FLAG=false
|
||||||
|
CORE_FORK="pi-hole"
|
||||||
|
WEB_FORK="pi-hole"
|
||||||
|
PADD_FORK="pi-hole"
|
||||||
|
|
||||||
# Check if buildx is installed
|
# Check if buildx is installed
|
||||||
docker buildx version >/dev/null 2>&1
|
docker buildx version >/dev/null 2>&1
|
||||||
@@ -34,13 +37,14 @@ fi
|
|||||||
check_branch_exists() {
|
check_branch_exists() {
|
||||||
local repo=$1
|
local repo=$1
|
||||||
local branch=$2
|
local branch=$2
|
||||||
|
local fork=$3
|
||||||
local url
|
local url
|
||||||
|
|
||||||
if [ "$repo" == "ftl" ]; then
|
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.
|
# 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"
|
url="https://ftl.pi-hole.net/${branch}/pihole-FTL-amd64"
|
||||||
else
|
else
|
||||||
url="https://github.com/pi-hole/${repo}/blob/${branch}/README.md"
|
url="https://github.com/${fork}/${repo}/blob/${branch}/README.md"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local http_code
|
local http_code
|
||||||
@@ -83,14 +87,14 @@ while [[ $# -gt 0 ]]; do
|
|||||||
;;
|
;;
|
||||||
-c | --corebranch)
|
-c | --corebranch)
|
||||||
CORE_BRANCH="$2"
|
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"
|
DOCKER_BUILD_CMD+=" --build-arg CORE_BRANCH=$CORE_BRANCH"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-w | --webbranch)
|
-w | --webbranch)
|
||||||
WEB_BRANCH="$2"
|
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"
|
DOCKER_BUILD_CMD+=" --build-arg WEB_BRANCH=$WEB_BRANCH"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
@@ -102,6 +106,24 @@ while [[ $# -gt 0 ]]; do
|
|||||||
shift
|
shift
|
||||||
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)
|
-t | --tag)
|
||||||
CUSTOM_TAG="$2"
|
CUSTOM_TAG="$2"
|
||||||
DOCKER_BUILD_CMD=${DOCKER_BUILD_CMD/$TAG/$CUSTOM_TAG}
|
DOCKER_BUILD_CMD=${DOCKER_BUILD_CMD/$TAG/$CUSTOM_TAG}
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ ARG FTL_BRANCH="development"
|
|||||||
ARG PIHOLE_DOCKER_TAG="dev-localbuild"
|
ARG PIHOLE_DOCKER_TAG="dev-localbuild"
|
||||||
ARG PADD_BRANCH="development"
|
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_UID=1000
|
||||||
ARG PIHOLE_GID=1000
|
ARG PIHOLE_GID=1000
|
||||||
|
|
||||||
@@ -55,11 +59,11 @@ ADD https://ftl.pi-hole.net/macvendor.db /macvendor.db
|
|||||||
COPY crontab.txt /crontab.txt
|
COPY crontab.txt /crontab.txt
|
||||||
|
|
||||||
# Add PADD to the container, too.
|
# 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
|
# 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 && \
|
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/pi-hole/pi-hole.git /etc/.pihole
|
git clone --depth 1 --single-branch --branch ${CORE_BRANCH} https://github.com/${CORE_FORK}/pi-hole.git /etc/.pihole
|
||||||
|
|
||||||
RUN cd /etc/.pihole && \
|
RUN cd /etc/.pihole && \
|
||||||
install -Dm755 -d /opt/pihole && \
|
install -Dm755 -d /opt/pihole && \
|
||||||
|
|||||||
Reference in New Issue
Block a user