Merge branch 'dev'

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2021-09-15 18:34:33 +01:00
commit 1b6318c0d9
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173
8 changed files with 149 additions and 169 deletions

View File

@ -1,19 +1,14 @@
232623name: Build & Deploy Nightly images
name: Build & Deploy Nightly images
on:
schedule:
- cron: '0 2 * * *'
jobs:
test-and-build:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ARCH: [amd64, armhf, arm64, i386]
DEBIAN_VERSION: [buster]
env:
ARCH: ${{matrix.ARCH}}
DEBIAN_VERSION: ${{matrix.DEBIAN_VERSION}}
ARCH: amd64
DEBIAN_VERSION: buster
CORE_VERSION: development
WEB_VERSION: devel
FTL_VERSION: development
@ -22,45 +17,46 @@ jobs:
uses: actions/checkout@v2
with:
ref: dev
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b nightly
- name: Run Tests
run: |
echo "Building ${ARCH}-${DEBIAN_VERSION}"
./gh-actions-test.sh
- name: Push the ARCH image
if: github.event_name != 'pull_request'
run: |
. gh-actions-vars.sh
echo "${{ secrets.DOCKERHUB_PASS }}" | docker login --username="${{ secrets.DOCKERHUB_USER }}" --password-stdin
docker push "${ARCH_IMAGE}"
- name: Upload gh-workspace
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v1
with:
name: gh-workspace
path: .gh-workspace
publish:
runs-on: ubuntu-latest
needs: test-and-build
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: dev
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b nightly
- name: Download workspace files
uses: actions/download-artifact@v1
with:
name: gh-workspace
path: .gh-workspace
- name: Tag and Publish multi-arch images
env:
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
run: |
./gh-actions-deploy.sh
build-and-publish:
if: github.event_name != 'pull_request'
needs: test
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Get the tag name
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
build-args: |
CORE_VERSION=development
WEB_VERSION=devel
FTL_VERSION=development
PIHOLE_VERSION=nightly
push: true
tags: |
pihole/pihole:nightly

View File

@ -7,20 +7,12 @@ on:
release:
types: [published]
#env:
# DOCKER_HUB_REPO: pihole
jobs:
test-and-build:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ARCH: [amd64, armhf, arm64, i386]
DEBIAN_VERSION: [buster]
env:
ARCH: ${{matrix.ARCH}}
DEBIAN_VERSION: ${{matrix.DEBIAN_VERSION}}
ARCH: amd64
DEBIAN_VERSION: buster
steps:
- name: Checkout Repo
uses: actions/checkout@v2
@ -28,34 +20,46 @@ jobs:
run: |
echo "Building ${ARCH}-${DEBIAN_VERSION}"
./gh-actions-test.sh
- name: Push the ARCH image
if: github.event_name != 'pull_request'
run: |
. gh-actions-vars.sh
echo "${{ secrets.DOCKERHUB_PASS }}" | docker login --username="${{ secrets.DOCKERHUB_USER }}" --password-stdin
docker push "${ARCH_IMAGE}"
- name: Upload gh-workspace
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v1
with:
name: gh-workspace
path: .gh-workspace
publish:
build-and-publish:
if: github.event_name != 'pull_request'
needs: test
runs-on: ubuntu-latest
needs: test-and-build
steps:
- name: Checkout Repo
-
name: Checkout
uses: actions/checkout@v2
- name: Download workspace files
uses: actions/download-artifact@v1
with:
name: gh-workspace
path: .gh-workspace
- name: Tag and Publish multi-arch images
env:
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
-
name: Get the tag name
run: |
./gh-actions-deploy.sh
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: pihole/pihole
github-token: ${{ secrets.GITHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
build-args: |
PIHOLE_VERSION=${{ env.TAG }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -11,25 +11,20 @@ on:
required: true
core:
description: 'Branch or tag of core repo'
required: true
required: false
web:
description: 'Branch or tag of web repo'
required: true
required: false
ftl:
description: 'Branch or tag of ftl repo'
required: true
required: false
jobs:
test-and-build:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ARCH: [amd64, armhf, arm64, i386]
DEBIAN_VERSION: [buster]
env:
ARCH: ${{matrix.ARCH}}
DEBIAN_VERSION: ${{matrix.DEBIAN_VERSION}}
ARCH: amd64
DEBIAN_VERSION: buster
CORE_VERSION: ${{ github.event.inputs.core }}
WEB_VERSION: ${{ github.event.inputs.web }}
FTL_VERSION: ${{ github.event.inputs.ftl }}
@ -38,45 +33,41 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch }}
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b ${{ github.event.inputs.name }}
- name: Run Tests
run: |
echo "Building ${ARCH}-${DEBIAN_VERSION}"
./gh-actions-test.sh
# - name: Push the ARCH image
# if: github.event_name != 'pull_request'
# run: |
# . gh-actions-vars.sh
# echo "${{ secrets.DOCKERHUB_PASS }}" | docker login --username="${{ secrets.DOCKERHUB_USER }}" --password-stdin
# docker push "${ARCH_IMAGE}"
- name: Upload gh-workspace
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v1
with:
name: gh-workspace
path: .gh-workspace
publish:
build-and-publish:
needs: test
runs-on: ubuntu-latest
needs: test-and-build
steps:
- name: Checkout Repo
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
ref: dev
- name: Checkout Dummy Branch to set image name
run: |
git checkout -b ${{ github.event.inputs.name }}
- name: Download workspace files
uses: actions/download-artifact@v1
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
name: gh-workspace
path: .gh-workspace
- name: Tag and Publish multi-arch images
env:
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
run: |
./gh-actions-deploy.sh
context: .
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
build-args: |
CORE_VERSION=${{ github.event.inputs.core }}
WEB_VERSION=${{ github.event.inputs.web }}
FTL_VERSION=${{ github.event.inputs.ftl }}
PIHOLE_VERSION=${{ github.event.inputs.name }}
push: true
tags: |
pihole/pihole:${{ github.event.inputs.name }}

View File

@ -1,19 +1,16 @@
ARG PIHOLE_BASE
FROM $PIHOLE_BASE
FROM "${PIHOLE_BASE:-debian:buster-slim}"
ARG PIHOLE_ARCH
ENV PIHOLE_ARCH "${PIHOLE_ARCH}"
ARG PIHOLE_TAG
ENV PIHOLE_TAG "${PIHOLE_TAG}"
ARG CORE_VERSION
ENV CORE_VERSION "${CORE_VERSION}"
ARG WEB_VERSION
ENV WEB_VERSION "${WEB_VERSION}"
ARG FTL_VERSION
ENV FTL_VERSION "${FTL_VERSION}"
ARG S6_ARCH
ARG S6_VERSION
ENV S6OVERLAY_RELEASE "https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.gz"
ARG PIHOLE_VERSION
ENV PIHOLE_VERSION "${PIHOLE_VERSION}"
ENV S6_OVERLAY_VERSION v2.1.0.2
COPY install.sh /usr/local/bin/install.sh
ENV PIHOLE_INSTALL /etc/.pihole/automated\ install/basic-install.sh
@ -28,9 +25,9 @@ COPY s6/service /usr/local/bin/service
# php config start passes special ENVs into
ARG PHP_ENV_CONFIG
ENV PHP_ENV_CONFIG "${PHP_ENV_CONFIG}"
ENV PHP_ENV_CONFIG /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
ARG PHP_ERROR_LOG
ENV PHP_ERROR_LOG "${PHP_ERROR_LOG}"
ENV PHP_ERROR_LOG /var/log/lighttpd/error.log
COPY ./start.sh /
COPY ./bash_functions.sh /
@ -49,16 +46,8 @@ ENV ServerIP 0.0.0.0
ENV FTL_CMD no-daemon
ENV DNSMASQ_USER root
ARG PIHOLE_VERSION
ENV VERSION "${PIHOLE_VERSION}"
ENV PATH /opt/pihole:${PATH}
ARG NAME
LABEL image="${NAME}:${PIHOLE_VERSION}_${PIHOLE_ARCH}"
ARG MAINTAINER
LABEL maintainer="${MAINTAINER}"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
HEALTHCHECK CMD dig +short +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1
SHELL ["/bin/bash", "-c"]
SHELL ["/bin/bash", "-c"]

View File

@ -63,7 +63,6 @@ def build(docker_repo: str, arch: str, debian_version: str, hub_tag: str, show_t
build_env = os.environ.copy()
build_env['PIHOLE_VERSION'] = os.environ.get('GIT_TAG', None)
build_env['DEBIAN_VERSION'] = debian_version
build_env['PIHOLE_TAG'] = tag_name
build_command = f'{time_arg} docker-compose -f build.yml build {cache_arg} --pull {arch}'
print(f' ::: Building {arch} into {create_tag}')
success = run_and_stream_command_output(build_command, build_env, verbose)

View File

@ -3,16 +3,9 @@ version: "3.7"
x-common-args: &common-args
PIHOLE_VERSION: ${PIHOLE_VERSION}
PIHOLE_TAG: ${PIHOLE_TAG}
CORE_VERSION: ${CORE_VERSION}
WEB_VERSION: ${WEB_VERSION}
FTL_VERSION: ${FTL_VERSION}
NAME: pihole/pihole
MAINTAINER: adam@diginc.us
S6_VERSION: v2.1.0.2
PHP_ENV_CONFIG: /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
PHP_ERROR_LOG: /var/log/lighttpd/error.log
services:
amd64:
@ -22,8 +15,6 @@ services:
args:
<<: *common-args
PIHOLE_BASE: pihole/debian-base:${DEBIAN_VERSION:-buster}
PIHOLE_ARCH: amd64
S6_ARCH: amd64
armel:
image: pihole:${PIHOLE_VERSION}-armel-${DEBIAN_VERSION:-buster}
build:
@ -31,8 +22,6 @@ services:
args:
<<: *common-args
PIHOLE_BASE: pihole/debian-debootstrap:armel-${DEBIAN_VERSION:-buster}-slim
PIHOLE_ARCH: armel
S6_ARCH: arm
armhf:
image: pihole:${PIHOLE_VERSION}-armhf-${DEBIAN_VERSION:-buster}
build:
@ -40,8 +29,6 @@ services:
args:
<<: *common-args
PIHOLE_BASE: pihole/debian-debootstrap:armhf-${DEBIAN_VERSION:-buster}-slim
PIHOLE_ARCH: arm
S6_ARCH: arm
arm64:
image: pihole:${PIHOLE_VERSION}-arm64-${DEBIAN_VERSION:-buster}
build:
@ -49,14 +36,10 @@ services:
args:
<<: *common-args
PIHOLE_BASE: pihole/debian-debootstrap:arm64-${DEBIAN_VERSION:-buster}-slim
PIHOLE_ARCH: arm64
S6_ARCH: aarch64
i386:
image: pihole:${PIHOLE_VERSION}-i386-${DEBIAN_VERSION:-buster}
build:
context: .
args:
<<: *common-args
PIHOLE_BASE: pihole/debian-debootstrap:i386-${DEBIAN_VERSION:-buster}-slim
PIHOLE_ARCH: i386
S6_ARCH: x86
PIHOLE_BASE: pihole/debian-debootstrap:i386-${DEBIAN_VERSION:-buster}-slim

View File

@ -8,13 +8,31 @@ WEB_LOCAL_REPO=/var/www/html/admin
setupVars=/etc/pihole/setupVars.conf
s6_download_url() {
DETECTED_ARCH=$(dpkg --print-architecture)
S6_ARCH=$DETECTED_ARCH
case $DETECTED_ARCH in
armel)
S6_ARCH="arm";;
armhf)
S6_ARCH="arm";;
arm64)
S6_ARCH="aarch64";;
i386)
S6_ARCH="x86";;
ppc64el)
S6_ARCH="ppc64le";;
esac
echo "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.gz"
}
apt-get update
apt-get install --no-install-recommends -y curl procps ca-certificates git
# curl in armhf-buster's image has SSL issues. Running c_rehash fixes it.
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923479
c_rehash
ln -s `which echo` /usr/local/bin/whiptail
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C /
curl -L -s "$(s6_download_url)" | tar xvzf - -C /
mv /init /s6-init
# Preseed variables to assist with using --unattended install
@ -68,12 +86,12 @@ sed -i $'s/)\s*reconfigurePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
sed -i $'s/)\s*uninstallFunc/) unsupportedFunc/g' /usr/local/bin/pihole
# Inject a message into the debug scripts Operating System section to indicate that the debug log comes from a Docker system.
sed -i $'s/echo_current_diagnostic "Operating system"/echo_current_diagnostic "Operating system"\\\n log_write "${INFO} Pi-hole Docker Container: ${PIHOLE_TAG:-PIHOLE_TAG is unset}"/g' /opt/pihole/piholeDebug.sh
sed -i $'s/echo_current_diagnostic "Operating system"/echo_current_diagnostic "Operating system"\\\n log_write "${INFO} Pi-hole Docker Container: ${PIHOLE_VERSION:-PIHOLE_VERSION is unset}"/g' /opt/pihole/piholeDebug.sh
# Inject container tag into web interface footer...
sed -i $"s/<ul class=\"list-unstyled\">/<ul class=\"list-unstyled\">\\n<strong><li>Docker Tag<\/strong> ${PIHOLE_TAG//\//\\/}<\/li>/g" /var/www/html/admin/scripts/pi-hole/php/footer.php
sed -i $"s/<ul class=\"list-inline\">/<strong>Docker Tag<\/strong> ${PIHOLE_TAG//\//\\/}\\n<ul class=\"list-inline\">/g" /var/www/html/admin/scripts/pi-hole/php/footer.php
sed -i $"s/<ul class=\"list-unstyled\">/<ul class=\"list-unstyled\">\\n<strong><li>Docker Tag<\/strong> ${PIHOLE_VERSION}<\/li>/g" /var/www/html/admin/scripts/pi-hole/php/footer.php
sed -i $"s/<ul class=\"list-inline\">/<strong>Docker Tag<\/strong> ${PIHOLE_VERSION}\\n<ul class=\"list-inline\">/g" /var/www/html/admin/scripts/pi-hole/php/footer.php
touch /.piholeFirstBoot
echo 'Docker install successful'
echo 'Docker install successful'

View File

@ -36,4 +36,4 @@ fi
pihole -v
echo " Container tag is: ${PIHOLE_TAG}"
echo " Container tag is: ${PIHOLE_VERSION}"