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:
diginc
2017-10-02 22:52:02 -05:00
parent db443aa0dc
commit 18997fe9f6
13 changed files with 50 additions and 307 deletions

View File

@@ -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