Merge branch 'dev' of github.com:diginc/docker-pi-hole into prerelease

Signed-off-by: Adam Hill <adam@diginc.us>
This commit is contained in:
Adam Hill 2018-07-17 19:44:34 -05:00
commit 478b98c503
No known key found for this signature in database
GPG Key ID: 2193804FCA429855
8 changed files with 90 additions and 24 deletions

View File

@ -6,9 +6,10 @@ env:
global:
- QEMU_VER=v2.9.1
matrix:
- OS=debian ARCH=amd64
- OS=debian ARCH=armhf
- OS=debian ARCH=aarch64
- ARCH=amd64
- ARCH=armel
- ARCH=armhf
- ARCH=aarch64
python:
- "2.7"
install:
@ -17,7 +18,7 @@ script:
# prepare qemu
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
# generate and build dockerfile
- ./Dockerfile.py --os=${OS} --arch=${ARCH} -v
- ./Dockerfile.py --arch=${ARCH} -v
- docker images
# run docker build & tests
- py.test -vv -n auto -k "${OS}-${ARCH}" ./test/
- py.test -vv -n auto -k "${ARCH}" ./test/

View File

@ -3,14 +3,14 @@
""" Dockerfile.py - generates and build dockerfiles
Usage:
Dockerfile.py [--os=<os> ...] [--arch=<arch> ...] [-v] [--no-build | --no-generate] [--no-cache]
Dockerfile.py [--arch=<arch> ...] [--skip=<arch> ...] [-v] [--no-build | --no-generate] [--no-cache]
Options:
--no-build Skip building the docker images
--no-cache Build without using any cache data
--no-generate Skip generating Dockerfiles from template
--os=<os> What OS(s) to build [default: debian]
--arch=<arch> What Architecture(s) to build [default: amd64 armhf aarch64]
--arch=<arch> What Architecture(s) to build [default: amd64 armel armhf aarch64]
--skip=<arch> What Architectures(s) to skip [default: None]
-v Print docker's command output [default: False]
Examples:
@ -43,6 +43,10 @@ images = {
'base': 'debian:stretch',
'arch': 'amd64'
},
{
'base': 'multiarch/debian-debootstrap:armel-stretch-slim',
'arch': 'armel'
},
{
'base': 'multiarch/debian-debootstrap:armhf-stretch-slim',
'arch': 'armhf'
@ -61,13 +65,17 @@ def generate_dockerfiles(args):
for os, archs in images.iteritems():
for image in archs:
if os not in args['--os'] and image['arch'] not in args['--arch']:
return
if image['arch'] not in args['--arch'] or image['arch'] in args['--skip']:
return
s6arch = image['arch']
if image['arch'] == 'armel':
s6arch = 'arm'
merged_data = dict(
{ 'os': os }.items() +
base_vars.items() +
os_base_vars[os].items() +
image.items()
image.items() +
{ 's6arch': s6arch }.items()
)
j2_env = Environment(loader=FileSystemLoader(THIS_DIR),
trim_blocks=True)
@ -83,13 +91,12 @@ def build_dockerfiles(args):
print " ::: Skipping Dockerfile building"
return
for os in args['--os']:
for arch in args['--arch']:
docker_repo = 'pi-hole-multiarch'
if arch == 'amd64':
docker_repo = 'pi-hole'
for arch in args['--arch']:
docker_repo = 'pi-hole-multiarch'
if arch == 'amd64':
docker_repo = 'pi-hole'
build(docker_repo, os, arch, args)
build(docker_repo, 'debian', arch, args)
def build(docker_repo, os, arch, args):
@ -119,7 +126,7 @@ def build(docker_repo, os, arch, args):
if __name__ == '__main__':
args = docopt(__doc__, version='Dockerfile 0.1')
args = docopt(__doc__, version='Dockerfile 0.2')
# print args
generate_dockerfiles(args)

View File

@ -11,7 +11,7 @@ ENV PATH /opt/pihole:${PATH}
COPY install.sh /usr/local/bin/docker-install.sh
ENV setupVars /etc/pihole/setupVars.conf
ENV PIHOLE_INSTALL /tmp/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ pihole.s6_version }}/s6-overlay-{{ pihole.arch }}.tar.gz
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ pihole.s6_version }}/s6-overlay-{{ pihole.s6arch }}.tar.gz
RUN apt-get update && \
apt-get install -y curl procps && \

50
Dockerfile_debian_armel Normal file
View File

@ -0,0 +1,50 @@
FROM multiarch/debian-debootstrap:armel-stretch-slim
LABEL image="diginc/pi-hole:debian_armel"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/diginc/docker-pi-hole"
ENV TAG debian
ENV ARCH armel
ENV PATH /opt/pihole:${PATH}
COPY install.sh /usr/local/bin/docker-install.sh
ENV setupVars /etc/pihole/setupVars.conf
ENV PIHOLE_INSTALL /tmp/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-arm.tar.gz
RUN apt-get update && \
apt-get install -y wget curl net-tools cron procps && \
curl -L -s $S6OVERLAY_RELEASE \
| tar xvzf - -C / && \
docker-install.sh && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init
ENTRYPOINT [ "/s6-init" ]
ADD s6/debian-root /
COPY s6/service /usr/local/bin/service
# php config start passes special ENVs into
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
COPY ./start.sh /
COPY ./bash_functions.sh /
# IPv6 disable flag for networks/devices that do not support it
ENV IPv6 True
EXPOSE 53 53/udp
EXPOSE 67/udp
EXPOSE 80
EXPOSE 443
ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
SHELL ["/bin/bash", "-c"]

View File

@ -107,7 +107,7 @@ The primary docker tags / versions are explained in the following table. [Click
This version of the docker aims to be as close to a standard pi-hole installation by using the recommended base OS and the exact configs and scripts (minimally modified to get them working). This enables fast updating when an update comes from pi-hole.
### `diginc/pi-hole-multiarch:debian_armhf` [![](https://images.microbadger.com/badges/image/diginc/pi-hole-multiarch:debian_armhf.svg)](https://microbadger.com/images/diginc/pi-hole-multiarch "Get your own image badge on microbadger.com")
Latest version of ARM-compatible pihole image
Latest version of ARMv7-compatible pihole image
https://hub.docker.com/r/diginc/pi-hole-multiarch/tags/
@ -116,6 +116,11 @@ Latest version of ARM64-compatible pihole image
https://hub.docker.com/r/diginc/pi-hole-multiarch/tags/
### `diginc/pi-hole-multiarch:debian_armel` [![](https://images.microbadger.com/badges/image/diginc/pi-hole-multiarch:debian_armel.svg)](https://microbadger.com/images/diginc/pi-hole-multiarch "Get your own image badge on microbadger.com")
Latest version of ARMv6-compatible pihole image
https://hub.docker.com/r/diginc/pi-hole-multiarch/tags/
## Upgrading, Persistence, and Customizations
The standard pi-hole customization abilities apply to this docker, but with docker twists such as using docker volume mounts to map host stored file configurations over the container defaults. Volumes are also important to persist the configuration in case you have removed the pi-hole container which is a typical docker upgrade pattern.

View File

@ -6,7 +6,6 @@ if [ ! -f ~/.docker/config.json ] ; then
exit 1
fi
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}

View File

@ -54,7 +54,7 @@ def DockerPersist(request, persist_args, persist_image, persist_cmd, Dig):
def args(request):
return '-e ServerIP="127.0.0.1" -e ServerIPv6="::1"'
@pytest.fixture(params=['amd64', 'armhf', 'aarch64'])
@pytest.fixture(params=['amd64', 'armel', 'armhf', 'aarch64'])
def arch(request):
return request.param

View File

@ -5,5 +5,9 @@ envlist = py27
whitelist_externals = docker
deps = -rrequirements.txt
commands = docker run --rm --privileged multiarch/qemu-user-static:register --reset
./Dockerfile.py -v
pytest {posargs:-vv -n auto} ./test/
./Dockerfile.py -v --arch amd64
pytest -vv -n auto -k amd64 ./test/
./Dockerfile.py -v --skip amd64
pytest -vv -n auto -k armel ./test/
pytest -vv -n auto -k armhf ./test/
pytest -vv -n auto -k aarch64 ./test/