Add PADD branch switch to build script. Fix casing of as->AS in Dockerfile to silence a warning about casing

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2024-06-22 12:21:28 +01:00
parent 56c110a2cc
commit f9dd3dfa1d
2 changed files with 11 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ usage() {
echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)" echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)"
echo " -c, --corebranch <branch> Specify Core branch" echo " -c, --corebranch <branch> Specify Core branch"
echo " -w, --webbranch <branch> Specify Web 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)" echo " -t, --tag <tag> Specify Docker image tag (default: pihole)"
echo " -l, --local Use locally built FTL binary (requires src/pihole-FTL file)" 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 " use_cache Enable caching (by default --no-cache is used)"
@@ -61,6 +62,12 @@ while [[ $# -gt 0 ]]; do
shift shift
shift shift
;; ;;
-p | --paddbranch)
PADD_BRANCH="$2"
DOCKER_BUILD_CMD+=" --build-arg PADD_BRANCH=$PADD_BRANCH"
shift
shift
;;
-t | --tag) -t | --tag)
TAG="$2" TAG="$2"
DOCKER_BUILD_CMD=${DOCKER_BUILD_CMD/pihole/$TAG} DOCKER_BUILD_CMD=${DOCKER_BUILD_CMD/pihole/$TAG}

View File

@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
ARG FTL_SOURCE=remote ARG FTL_SOURCE=remote
ARG alpine_version="3.19" ARG alpine_version="3.19"
FROM alpine:${alpine_version} as base FROM alpine:${alpine_version} AS base
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope # https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETPLATFORM ARG TARGETPLATFORM
@@ -69,7 +69,7 @@ COPY --chmod=0755 start.sh /usr/bin/start.sh
## Buildkit can do some fancy stuff and we can use it to either download FTL from ftl.pi-hole.net or use a local copy ## Buildkit can do some fancy stuff and we can use it to either download FTL from ftl.pi-hole.net or use a local copy
FROM base as remote-ftl-install FROM base AS remote-ftl-install
# Default stage if FTL_SOURCE is not explicitly set to "local" # Default stage if FTL_SOURCE is not explicitly set to "local"
# Download the latest version of pihole-FTL for the correct architecture # Download the latest version of pihole-FTL for the correct architecture
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then FTLARCH=amd64; \ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then FTLARCH=amd64; \
@@ -85,12 +85,12 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then FTLARCH=amd64; \
&& chmod +x /usr/bin/pihole-FTL \ && chmod +x /usr/bin/pihole-FTL \
&& readelf -h /usr/bin/pihole-FTL || cat /usr/bin/pihole-FTL && readelf -h /usr/bin/pihole-FTL || cat /usr/bin/pihole-FTL
FROM base as local-ftl-install FROM base AS local-ftl-install
# pihole-FTL must be built from source and copied to the build directory first! # pihole-FTL must be built from source and copied to the build directory first!
COPY --chmod=0755 pihole-FTL /usr/bin/pihole-FTL COPY --chmod=0755 pihole-FTL /usr/bin/pihole-FTL
# Use the appropriate FTL Install stage based on the FTL_SOURCE build-arg # Use the appropriate FTL Install stage based on the FTL_SOURCE build-arg
FROM ${FTL_SOURCE}-ftl-install as final FROM ${FTL_SOURCE}-ftl-install AS final
HEALTHCHECK CMD dig +short +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1 HEALTHCHECK CMD dig +short +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1