templated dockerfiles building used by tests
* test images are built without diginc/ namespace * no tests for other archs yet, unsure if they'll even build on travis * Removed old dockerfiles * New files names require Docker Cloud reconfiguration when merged upstream * Probably some stuff I missed, just ask me
This commit is contained in:
parent
db443aa0dc
commit
18997fe9f6
|
@ -4,36 +4,36 @@ import os
|
|||
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
base_vars = {
|
||||
'name': 'diginc/pi-hole',
|
||||
'name': 'pi-hole',
|
||||
'maintainer' : 'adam@diginc.us',
|
||||
's6_version' : 'v1.20.0.0',
|
||||
}
|
||||
|
||||
images = {
|
||||
'debian': [
|
||||
dict(base_vars.items() + {
|
||||
dict(base_vars.items() + {
|
||||
'base': 'debian:jessie',
|
||||
'arch': 'amd64'
|
||||
}.items()),
|
||||
dict(base_vars.items() + {
|
||||
dict(base_vars.items() + {
|
||||
'base': 'multiarch/debian-debootstrap:armhf-jessie-slim',
|
||||
'arch': 'armhf'
|
||||
}.items()),
|
||||
dict(base_vars.items() + {
|
||||
dict(base_vars.items() + {
|
||||
'base': 'multiarch/debian-debootstrap:arm64-jessie-slim',
|
||||
'arch': 'aarch64'
|
||||
}.items()),
|
||||
],
|
||||
'alpine': [
|
||||
dict(base_vars.items() + {
|
||||
dict(base_vars.items() + {
|
||||
'base': 'alpine:edge',
|
||||
'arch': 'amd64'
|
||||
}.items()),
|
||||
dict(base_vars.items() + {
|
||||
dict(base_vars.items() + {
|
||||
'base': 'multiarch/alpine:armhf-edge',
|
||||
'arch': 'armhf'
|
||||
}.items()),
|
||||
dict(base_vars.items() + {
|
||||
dict(base_vars.items() + {
|
||||
'base': 'multiarch/alpine:aarch64-edge',
|
||||
'arch': 'aarch64'
|
||||
}.items())
|
||||
|
@ -46,9 +46,9 @@ def generate_dockerfiles():
|
|||
j2_env = Environment(loader=FileSystemLoader(THIS_DIR),
|
||||
trim_blocks=True)
|
||||
template = j2_env.get_template('Dockerfile_{}.template'.format(os))
|
||||
|
||||
Dockerfile = 'Dockerfile_{}_{}'.format(os, image['arch'])
|
||||
with open(Dockerfile, 'w') as f:
|
||||
|
||||
dockerfile = 'Dockerfile_{}_{}'.format(os, image['arch'])
|
||||
with open(dockerfile, 'w') as f:
|
||||
f.write(template.render(os=os, image=image))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
FROM {{ image.base }}
|
||||
LABEL {{ image.maintainer }}
|
||||
LABEL maintainer="{{ image.maintainer }}"
|
||||
|
||||
ENV IMAGE {{ os }}
|
||||
ENV ARCH {{ image.arch }}
|
||||
|
@ -8,7 +8,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.20.0.0/s6-overlay-amd64.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ image.s6_version }}/s6-overlay-{{ image.arch }}.tar.gz
|
||||
|
||||
RUN apk upgrade --update && \
|
||||
apk add bind-tools wget curl bash libcap && \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
FROM multiarch/alpine:aarch64-edge
|
||||
LABEL adam@diginc.us
|
||||
LABEL maintainer="adam@diginc.us"
|
||||
|
||||
ENV IMAGE alpine
|
||||
ENV ARCH aarch64
|
||||
|
@ -8,7 +8,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.20.0.0/s6-overlay-amd64.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-aarch64.tar.gz
|
||||
|
||||
RUN apk upgrade --update && \
|
||||
apk add bind-tools wget curl bash libcap && \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
FROM alpine:edge
|
||||
LABEL adam@diginc.us
|
||||
LABEL maintainer="adam@diginc.us"
|
||||
|
||||
ENV IMAGE alpine
|
||||
ENV ARCH amd64
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
FROM multiarch/alpine:armhf-edge
|
||||
LABEL adam@diginc.us
|
||||
LABEL maintainer="adam@diginc.us"
|
||||
|
||||
ENV IMAGE alpine
|
||||
ENV ARCH armhf
|
||||
|
@ -8,7 +8,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.20.0.0/s6-overlay-amd64.tar.gz
|
||||
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-armhf.tar.gz
|
||||
|
||||
RUN apk upgrade --update && \
|
||||
apk add bind-tools wget curl bash libcap && \
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
FROM multiarch/alpine:armhf-edge
|
||||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
ENV IMAGE alpine
|
||||
ENV ARCH armhf
|
||||
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.20.0.0/s6-overlay-armhf.tar.gz
|
||||
|
||||
RUN apk upgrade --update && \
|
||||
apk add bind-tools wget curl bash libcap && \
|
||||
curl -L -s $S6OVERLAY_RELEASE \
|
||||
| tar xvzf - -C / && \
|
||||
docker-install.sh && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ENTRYPOINT [ "/init" ]
|
||||
|
||||
ADD s6/alpine-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# Things installer did and fix alpine+nginx differences
|
||||
ENV WEBLOGDIR /var/log/nginx
|
||||
ENV PHP_CONFIG '/etc/php5/php-fpm.conf'
|
||||
RUN mkdir -p /etc/pihole/ && \
|
||||
mkdir -p /var/www/html/pihole && \
|
||||
mkdir -p /var/www/html/admin/ && \
|
||||
chown nginx:nginx /var/www/html && \
|
||||
touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \
|
||||
chown -R nginx:nginx ${WEBLOGDIR} && \
|
||||
sed -i 's|^user\s*=.*$|user = nginx|' $PHP_CONFIG && \
|
||||
sed -i '/^;pid/ s|^;||' $PHP_CONFIG && \
|
||||
chmod 775 /var/www/html && \
|
||||
touch /var/log/pihole.log && \
|
||||
chmod 644 /var/log/pihole.log && \
|
||||
chown dnsmasq:root /var/log/pihole.log && \
|
||||
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
||||
cp -f /usr/bin/list.sh /opt/pihole/list.sh && \
|
||||
echo 'Done!'
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/nginx/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 80
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
|
@ -1,61 +0,0 @@
|
|||
FROM multiarch/alpine:aarch64-edge
|
||||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
ENV IMAGE alpine
|
||||
ENV ARCH aarch64
|
||||
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.20.0.0/s6-overlay-aarch64.tar.gz
|
||||
|
||||
RUN apk upgrade --update && \
|
||||
apk add bind-tools wget curl bash libcap && \
|
||||
curl -L -s $S6OVERLAY_RELEASE \
|
||||
| tar xvzf - -C / && \
|
||||
docker-install.sh && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ENTRYPOINT [ "/init" ]
|
||||
|
||||
ADD s6/alpine-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# Things installer did and fix alpine+nginx differences
|
||||
ENV WEBLOGDIR /var/log/nginx
|
||||
ENV PHP_CONFIG '/etc/php5/php-fpm.conf'
|
||||
RUN mkdir -p /etc/pihole/ && \
|
||||
mkdir -p /var/www/html/pihole && \
|
||||
mkdir -p /var/www/html/admin/ && \
|
||||
chown nginx:nginx /var/www/html && \
|
||||
touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \
|
||||
chown -R nginx:nginx ${WEBLOGDIR} && \
|
||||
sed -i 's|^user\s*=.*$|user = nginx|' $PHP_CONFIG && \
|
||||
sed -i '/^;pid/ s|^;||' $PHP_CONFIG && \
|
||||
chmod 775 /var/www/html && \
|
||||
touch /var/log/pihole.log && \
|
||||
chmod 644 /var/log/pihole.log && \
|
||||
chown dnsmasq:root /var/log/pihole.log && \
|
||||
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
||||
cp -f /usr/bin/list.sh /opt/pihole/list.sh && \
|
||||
echo 'Done!'
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/nginx/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 80
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
|
@ -1,61 +0,0 @@
|
|||
FROM alpine:edge
|
||||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
ENV IMAGE alpine
|
||||
ENV ARCH amd64
|
||||
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.20.0.0/s6-overlay-amd64.tar.gz
|
||||
|
||||
RUN apk upgrade --update && \
|
||||
apk add bind-tools wget curl bash libcap && \
|
||||
curl -L -s $S6OVERLAY_RELEASE \
|
||||
| tar xvzf - -C / && \
|
||||
docker-install.sh && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ENTRYPOINT [ "/init" ]
|
||||
|
||||
ADD s6/alpine-root /
|
||||
COPY s6/service /usr/local/bin/service
|
||||
|
||||
# Things installer did and fix alpine+nginx differences
|
||||
ENV WEBLOGDIR /var/log/nginx
|
||||
ENV PHP_CONFIG '/etc/php5/php-fpm.conf'
|
||||
RUN mkdir -p /etc/pihole/ && \
|
||||
mkdir -p /var/www/html/pihole && \
|
||||
mkdir -p /var/www/html/admin/ && \
|
||||
chown nginx:nginx /var/www/html && \
|
||||
touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \
|
||||
chown -R nginx:nginx ${WEBLOGDIR} && \
|
||||
sed -i 's|^user\s*=.*$|user = nginx|' $PHP_CONFIG && \
|
||||
sed -i '/^;pid/ s|^;||' $PHP_CONFIG && \
|
||||
chmod 775 /var/www/html && \
|
||||
touch /var/log/pihole.log && \
|
||||
chmod 644 /var/log/pihole.log && \
|
||||
chown dnsmasq:root /var/log/pihole.log && \
|
||||
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \
|
||||
cp -f /usr/bin/list.sh /opt/pihole/list.sh && \
|
||||
echo 'Done!'
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/nginx/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 80
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
|
@ -1,42 +0,0 @@
|
|||
FROM {{ image.base }}
|
||||
LABEL maintainer="{{ image.maintainer }}"
|
||||
|
||||
ENV IMAGE {{ os }}
|
||||
ENV ARCH {{ image.arch }}
|
||||
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.20.0.0/s6-overlay-armhf.tar.gz
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y wget curl net-tools cron && \
|
||||
curl -L -s $S6OVERLAY_RELEASE \
|
||||
| tar xvzf - -C / && \
|
||||
docker-install.sh && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "/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
|
||||
# not fully supported in debian yet
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 80
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
|
@ -1,42 +0,0 @@
|
|||
FROM debian:jessie
|
||||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
ENV IMAGE debian
|
||||
ENV ARCH amd64
|
||||
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.20.0.0/s6-overlay-amd64.tar.gz
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y wget curl net-tools cron && \
|
||||
curl -L -s $S6OVERLAY_RELEASE \
|
||||
| tar xvzf - -C / && \
|
||||
docker-install.sh && \
|
||||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||
|
||||
ENTRYPOINT [ "/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
|
||||
# not fully supported in debian yet
|
||||
ENV IPv6 True
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 80
|
||||
|
||||
ENV S6_LOGGING 0
|
||||
ENV S6_KEEP_ENV 1
|
||||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
import testinfra
|
||||
|
||||
WEB_SERVER = { 'alpine': 'nginx', 'debian': 'lighttpd' }
|
||||
WEB_SERVER = { 'alpine_amd64': 'nginx', 'debian_amd64': 'lighttpd' }
|
||||
|
||||
check_output = testinfra.get_backend(
|
||||
"local://"
|
||||
|
@ -9,7 +9,7 @@ check_output = testinfra.get_backend(
|
|||
|
||||
def DockerGeneric(request, args, image, cmd):
|
||||
assert 'docker' in check_output('id'), "Are you in the docker group?"
|
||||
if 'diginc/pi-hole' in image:
|
||||
if 'pi-hole' in image:
|
||||
args += " --dns 127.0.0.1 -v /dev/null:/etc/.pihole/adlists.default -e PYTEST=\"True\""
|
||||
docker_run = "docker run -d {} {} {}".format(args, image, cmd)
|
||||
print docker_run
|
||||
|
@ -56,7 +56,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=['alpine', 'debian'])
|
||||
@pytest.fixture(params=['alpine_amd64', 'debian_amd64'])
|
||||
def tag(request):
|
||||
return request.param
|
||||
|
||||
|
@ -66,7 +66,7 @@ def webserver(request, tag):
|
|||
|
||||
@pytest.fixture()
|
||||
def image(request, tag):
|
||||
return 'diginc/pi-hole:{}'.format(tag)
|
||||
return 'pi-hole:{}'.format(tag)
|
||||
|
||||
@pytest.fixture()
|
||||
def cmd(request):
|
||||
|
@ -76,7 +76,7 @@ def cmd(request):
|
|||
def persist_args(request):
|
||||
return '-e ServerIP="127.0.0.1" -e ServerIPv6="::1"'
|
||||
|
||||
@pytest.fixture(scope='module', params=['alpine', 'debian'])
|
||||
@pytest.fixture(scope='module', params=['alpine_amd64', 'debian_amd64'])
|
||||
def persist_tag(request):
|
||||
return request.param
|
||||
|
||||
|
@ -86,7 +86,7 @@ def persist_webserver(request, persist_tag):
|
|||
|
||||
@pytest.fixture(scope='module')
|
||||
def persist_image(request, persist_tag):
|
||||
return 'diginc/pi-hole:{}'.format(persist_tag)
|
||||
return 'pi-hole:{}'.format(persist_tag)
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def persist_cmd(request):
|
||||
|
|
|
@ -1,20 +1,30 @@
|
|||
''' This file starts with 000 to make it run first '''
|
||||
import pytest
|
||||
import testinfra
|
||||
import DockerfileGeneration
|
||||
|
||||
run_local = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").run
|
||||
|
||||
@pytest.mark.parametrize("upstream,image,tag", [
|
||||
( 'alpine:edge', 'alpine.docker', 'diginc/pi-hole:alpine' ),
|
||||
( 'debian:jessie', 'debian.docker', 'diginc/pi-hole:debian' ),
|
||||
#( 'jsurf/rpi-raspbian', 'debian-armhf.docker', 'diginc/pi-hole:arm' ),
|
||||
|
||||
def test_generate_dockerfiles():
|
||||
DockerfileGeneration.generate_dockerfiles()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("os, archs", [
|
||||
( 'debian' , DockerfileGeneration.images['debian'] ),
|
||||
( 'alpine' , DockerfileGeneration.images['alpine'] ),
|
||||
])
|
||||
def test_build_pihole_image(upstream, image, tag):
|
||||
run_local('docker pull {}'.format(upstream))
|
||||
build_cmd = run_local('docker build -f {} -t {} .'.format(image, tag))
|
||||
if build_cmd.rc != 0:
|
||||
print build_cmd.stdout
|
||||
print build_cmd.stderr
|
||||
assert build_cmd.rc == 0
|
||||
def test_build_pihole_image(os, archs):
|
||||
''' Build the entire matrix of OS+Architecture '''
|
||||
for image in archs:
|
||||
dockerfile = 'Dockerfile_{}_{}'.format(os, image['arch'])
|
||||
image_tag = '{}:{}_{}'.format(image['name'], os, image['arch'])
|
||||
|
||||
run_local('docker pull {}'.format(image['base']))
|
||||
build_cmd = run_local('docker build -f {} -t {} .'.format(dockerfile, image_tag))
|
||||
if build_cmd.rc != 0:
|
||||
print build_cmd.stdout
|
||||
print build_cmd.stderr
|
||||
assert build_cmd.rc == 0
|
||||
|
|
|
@ -11,10 +11,10 @@ DEFAULTARGS = '-e ServerIP="127.0.0.1" '
|
|||
])
|
||||
def test_IPv6_not_True_removes_ipv6(Docker, tag, args, expected_ipv6, expected_stdout):
|
||||
''' When a user overrides IPv6=True they only get IPv4 listening webservers '''
|
||||
IPV6_LINE = { 'alpine': 'listen [::]:80 default_server',
|
||||
'debian': 'use-ipv6.pl' }
|
||||
WEB_CONFIG = { 'alpine': '/etc/nginx/nginx.conf',
|
||||
'debian': '/etc/lighttpd/lighttpd.conf' }
|
||||
IPV6_LINE = { 'alpine_amd64': 'listen [::]:80 default_server',
|
||||
'debian_amd64': 'use-ipv6.pl' }
|
||||
WEB_CONFIG = { 'alpine_amd64': '/etc/nginx/nginx.conf',
|
||||
'debian_amd64': '/etc/lighttpd/lighttpd.conf' }
|
||||
|
||||
function = Docker.run('. /bash_functions.sh ; setup_ipv4_ipv6')
|
||||
assert "Using {}".format(expected_stdout) in function.stdout
|
||||
|
@ -55,8 +55,8 @@ expected_debian_lines = [
|
|||
'"PHP_ERROR_LOG" => "/var/log/lighttpd/error.log"'
|
||||
]
|
||||
@pytest.mark.parametrize('tag,expected_lines,repeat_function', [
|
||||
('debian', expected_debian_lines, 1),
|
||||
('debian', expected_debian_lines, 2)
|
||||
('debian_amd64', expected_debian_lines, 1),
|
||||
('debian_amd64', expected_debian_lines, 2)
|
||||
])
|
||||
def test_debian_setup_php_env(Docker, tag, expected_lines, repeat_function):
|
||||
''' confirm all expected output is there and nothing else '''
|
||||
|
|
Loading…
Reference in New Issue