Skip to content

Commit dde9b69

Browse files
Merge branch 'development' into development
2 parents 4654fac + 4aecdbe commit dde9b69

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

build.sh

+32
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,34 @@ TAG="pihole:local"
2222
DOCKER_BUILD_CMD="docker buildx build src/. --tag ${TAG} --load --no-cache"
2323
FTL_FLAG=false
2424

25+
# Check if buildx is installed
26+
docker buildx version >/dev/null 2>&1
27+
if [ $? -ne 0 ]; then
28+
echo "Error: Docker buildx is required to build this image. For installation instructions, see:"
29+
echo " https://github.com/docker/buildx#installing"
30+
exit 1
31+
fi
32+
33+
# Function to check if a custom branch entered by the user is valid
34+
check_branch_exists() {
35+
local repo=$1
36+
local branch=$2
37+
local url
38+
39+
if [ "$repo" == "ftl" ]; then
40+
# Special case for FTL - we check for the binary instead of just the branch - in case it is not yet built.
41+
url="https://ftl.pi-hole.net/${branch}/pihole-FTL-amd64"
42+
else
43+
url="https://github.com/pi-hole/${repo}/blob/${branch}/README.md"
44+
fi
45+
46+
local http_code=$(curl -sI "$url" -o /dev/null -w "%{http_code}")
47+
if [ $http_code -ne 200 ]; then
48+
echo "Error: $repo branch '$branch' not found. Exiting."
49+
exit 1
50+
fi
51+
}
52+
2553
# Parse command line arguments
2654
while [[ $# -gt 0 ]]; do
2755
key="$1"
@@ -47,24 +75,28 @@ while [[ $# -gt 0 ]]; do
4775
fi
4876
FTL_FLAG=true
4977
FTL_BRANCH="$2"
78+
check_branch_exists "ftl" "$FTL_BRANCH"
5079
DOCKER_BUILD_CMD+=" --build-arg FTL_BRANCH=$FTL_BRANCH"
5180
shift
5281
shift
5382
;;
5483
-c | --corebranch)
5584
CORE_BRANCH="$2"
85+
check_branch_exists "pi-hole" "$CORE_BRANCH"
5686
DOCKER_BUILD_CMD+=" --build-arg CORE_BRANCH=$CORE_BRANCH"
5787
shift
5888
shift
5989
;;
6090
-w | --webbranch)
6191
WEB_BRANCH="$2"
92+
check_branch_exists "web" "$WEB_BRANCH"
6293
DOCKER_BUILD_CMD+=" --build-arg WEB_BRANCH=$WEB_BRANCH"
6394
shift
6495
shift
6596
;;
6697
-p | --paddbranch)
6798
PADD_BRANCH="$2"
99+
check_branch_exists "padd" "$PADD_BRANCH"
68100
DOCKER_BUILD_CMD+=" --build-arg PADD_BRANCH=$PADD_BRANCH"
69101
shift
70102
shift

src/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
ARG FTL_SOURCE=remote
3-
ARG alpine_version="3.20"
3+
ARG alpine_version="3.21"
44
FROM alpine:${alpine_version} AS base
55
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
66

test/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pytest == 8.3.3
1+
pytest == 8.3.4
22
pytest-xdist == 3.6.1
33
pytest-testinfra == 10.1.1
44
black == 24.10.0

0 commit comments

Comments
 (0)