diff --git a/.travis.yml b/.travis.yml index 4623f24..0657462 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ env: - QEMU_VER=v2.9.1 matrix: - OS=debian ARCH=amd64 + - OS=debian ARCH=armel - OS=debian ARCH=armhf - OS=debian ARCH=aarch64 python: diff --git a/Dockerfile.py b/Dockerfile.py index ea56ccc..691fab8 100755 --- a/Dockerfile.py +++ b/Dockerfile.py @@ -3,14 +3,14 @@ """ Dockerfile.py - generates and build dockerfiles Usage: - Dockerfile.py [--os= ...] [--arch= ...] [-v] [--no-build | --no-generate] [--no-cache] + Dockerfile.py [--os= ...] [--arch= ...] [--skip= ...] [-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= What OS(s) to build [default: debian] - --arch= What Architecture(s) to build [default: amd64 armhf aarch64] + --arch= What Architecture(s) to build [default: amd64 armel armhf aarch64] + --skip= What Architectures(s) to skip [default: None] -v Print docker's command output [default: False] Examples: @@ -27,7 +27,7 @@ THIS_DIR = os.path.dirname(os.path.abspath(__file__)) base_vars = { 'name': 'diginc/pi-hole', 'maintainer' : 'adam@diginc.us', - 's6_version' : 'v1.21.2.2', + 's6_version' : 'v1.21.4.0', } os_base_vars = { @@ -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,18 @@ 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 os not in args['--os'] and 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) diff --git a/Dockerfile.template b/Dockerfile.template index 5748146..7b5b4bd 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -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 wget curl net-tools cron procps && \ diff --git a/Dockerfile_debian_aarch64 b/Dockerfile_debian_aarch64 index 8d0328f..a72f7d0 100644 --- a/Dockerfile_debian_aarch64 +++ b/Dockerfile_debian_aarch64 @@ -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/v1.21.2.2/s6-overlay-aarch64.tar.gz +ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-aarch64.tar.gz RUN apt-get update && \ apt-get install -y wget curl net-tools cron procps && \ diff --git a/Dockerfile_debian_amd64 b/Dockerfile_debian_amd64 index 06dcd17..20e083e 100644 --- a/Dockerfile_debian_amd64 +++ b/Dockerfile_debian_amd64 @@ -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/v1.21.2.2/s6-overlay-amd64.tar.gz +ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-amd64.tar.gz RUN apt-get update && \ apt-get install -y wget curl net-tools cron procps && \ diff --git a/Dockerfile_debian_armel b/Dockerfile_debian_armel new file mode 100644 index 0000000..a96851b --- /dev/null +++ b/Dockerfile_debian_armel @@ -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"] \ No newline at end of file diff --git a/Dockerfile_debian_armhf b/Dockerfile_debian_armhf index 4b4cd4b..3bcb2e8 100644 --- a/Dockerfile_debian_armhf +++ b/Dockerfile_debian_armhf @@ -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/v1.21.2.2/s6-overlay-armhf.tar.gz +ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-armhf.tar.gz RUN apt-get update && \ apt-get install -y wget curl net-tools cron procps && \ diff --git a/test/conftest.py b/test/conftest.py index f122a65..f27f738 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -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 diff --git a/tox.ini b/tox.ini index 75134c9..4fb58a5 100644 --- a/tox.ini +++ b/tox.ini @@ -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/