v4.2 and Version pulled from a file now

Signed-off-by: Adam Hill <adam@diginc.us>
This commit is contained in:
Adam Hill 2019-01-20 23:59:30 -06:00
parent 7ec893ae3f
commit 440a7a19a5
No known key found for this signature in database
GPG Key ID: 2193804FCA429855
10 changed files with 40 additions and 23 deletions

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
""" Dockerfile.py - generates and build dockerfiles
Usage:
@ -36,8 +35,13 @@ os_base_vars = {
'php_error_log': '/var/log/lighttpd/error.log'
}
__version = None
dot = os.path.abspath('.')
with open('{}/VERSION'.format(dot), 'r') as v:
__version = v.read().strip()
images = {
'v4.1.1': [
__version: [
{
'base': 'pihole/debian-base:latest',
'arch': 'amd64'
@ -95,16 +99,16 @@ def build_dockerfiles(args):
if arch == 'armel':
print "Skipping armel, incompatible upstream binaries/broken"
continue
build('pihole', 'v4.1.1', arch, args)
build('pihole', arch, args)
def build(docker_repo, version, arch, args):
def build(docker_repo, arch, args):
run_local = testinfra.get_backend(
"local://"
).get_module("Command").run
dockerfile = 'Dockerfile_{}'.format(arch)
repo_tag = '{}:{}_{}'.format(docker_repo, version, arch)
repo_tag = '{}:{}_{}'.format(docker_repo, __version, arch)
cached_image = '{}/{}'.format('pihole', repo_tag)
time=''
if args['-t']:

View File

@ -2,6 +2,7 @@ FROM {{ pihole.base }}
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ pihole.s6_version }}/s6-overlay-{{ pihole.s6arch }}.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
ENV PIHOLE_INSTALL /root/ph_install.sh
RUN bash -ex install.sh 2>&1 && \

View File

@ -2,6 +2,7 @@ FROM multiarch/debian-debootstrap:arm64-stretch-slim
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-aarch64.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
ENV PIHOLE_INSTALL /root/ph_install.sh
RUN bash -ex install.sh 2>&1 && \
@ -31,11 +32,11 @@ ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV VERSION v4.1.1
ENV VERSION v4.2
ENV ARCH aarch64
ENV PATH /opt/pihole:${PATH}
LABEL image="pihole/pihole:v4.1.1_aarch64"
LABEL image="pihole/pihole:v4.2_aarch64"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

View File

@ -2,6 +2,7 @@ FROM pihole/debian-base:latest
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-amd64.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
ENV PIHOLE_INSTALL /root/ph_install.sh
RUN bash -ex install.sh 2>&1 && \
@ -31,11 +32,11 @@ ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV VERSION v4.1.1
ENV VERSION v4.2
ENV ARCH amd64
ENV PATH /opt/pihole:${PATH}
LABEL image="pihole/pihole:v4.1.1_amd64"
LABEL image="pihole/pihole:v4.2_amd64"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

View File

@ -2,6 +2,7 @@ FROM multiarch/debian-debootstrap:armel-stretch-slim
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-arm.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
ENV PIHOLE_INSTALL /root/ph_install.sh
RUN bash -ex install.sh 2>&1 && \
@ -31,11 +32,11 @@ ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV VERSION v4.1.1
ENV VERSION v4.2
ENV ARCH armel
ENV PATH /opt/pihole:${PATH}
LABEL image="pihole/pihole:v4.1.1_armel"
LABEL image="pihole/pihole:v4.2_armel"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

View File

@ -2,6 +2,7 @@ FROM multiarch/debian-debootstrap:armhf-stretch-slim
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-armhf.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
ENV PIHOLE_INSTALL /root/ph_install.sh
RUN bash -ex install.sh 2>&1 && \
@ -31,11 +32,11 @@ ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV VERSION v4.1.1
ENV VERSION v4.2
ENV ARCH armhf
ENV PATH /opt/pihole:${PATH}
LABEL image="pihole/pihole:v4.1.1_armhf"
LABEL image="pihole/pihole:v4.2_armhf"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

1
VERSION Normal file
View File

@ -0,0 +1 @@
v4.2

View File

@ -28,6 +28,7 @@ namespace='pihole'
localimg='pihole'
remoteimg="$namespace/$localimg"
branch="$(parse_git_branch)"
local_version="$(cat VERSION)"
version="${version:-unset}"
dry="${dry}"
latest="${latest:-false}" # true as shell env var to deploy latest
@ -70,7 +71,7 @@ $dry tox
images=()
for tag in ${!arch_map[@]}; do
# Verison specific tags for ongoing history
$dry docker tag $localimg:v4.1.1_$tag $remoteimg:${version}_${tag}
$dry docker tag $localimg:${local_version}_$tag $remoteimg:${version}_${tag}
$dry docker push pihole/pihole:${version}_${tag}
images+=(pihole/pihole:${version}_${tag})
done

View File

@ -3,10 +3,10 @@
mkdir -p /etc/pihole/
mkdir -p /var/run/pihole
# Production tags with valid web footers
export CORE_TAG='v4.1.1'
export WEB_TAG='v4.1.1'
export CORE_TAG="$(cat /etc/docker-pi-hole-version)"
export WEB_TAG="$(cat /etc/docker-pi-hole-version)"
# Only use for pre-production / testing
export USE_CUSTOM_BRANCHES=false
export USE_CUSTOM_BRANCHES=true
apt-get update
apt-get install -y curl procps
@ -14,7 +14,7 @@ curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C /
mv /init /s6-init
if [[ $USE_CUSTOM_BRANCHES == true ]] ; then
CORE_TAG='release/vx.y.z'
CORE_TAG="release/$(cat /etc/docker-pi-hole-version)"
fi
# debconf-apt-progress seems to hang so get rid of it too
@ -68,9 +68,10 @@ mv "${tmpLog}" /
if [[ $USE_CUSTOM_BRANCHES == true ]] ; then
ln -s /bin/true /usr/local/bin/service
ln -s /bin/true /usr/local/bin/update-rc.d
echo y | bash -x pihole checkout core $CORE_TAG
echo y | bash -x pihole checkout web $CORE_TAG
echo y | bash -x pihole checkout ftl ${CORE_TAG/v/}
echo y | bash -x pihole checkout core ${CORE_TAG}
echo y | bash -x pihole checkout web ${CORE_TAG}
echo y | bash -x pihole checkout ftl ${CORE_TAG}
# If the v is forgotten: ${CORE_TAG/v/}
unlink /usr/local/bin/service
unlink /usr/local/bin/update-rc.d
else

View File

@ -5,6 +5,11 @@ check_output = testinfra.get_backend(
"local://"
).get_module("Command").check_output
__version__ = None
dotdot = os.path.abspath(os.path.join('.', os.pardir))
with open('{}/VERSION'.format(dotdot), 'r') as v:
__version__ = v.read().strip()
@pytest.fixture()
def args_dns():
return '--dns 127.0.0.1 --dns 1.1.1.1'
@ -91,7 +96,7 @@ def arch(request):
@pytest.fixture()
def version(request):
''' TODO: include from external .py that can be shared with Dockerfile.py / Tests / deploy scripts '''
return 'v4.1.1'
return __version__
@pytest.fixture()
def tag(request, version, arch):
@ -119,7 +124,7 @@ def persist_arch(request):
@pytest.fixture(scope='module')
def persist_version(request):
''' TODO: include from external .py that can be shared with Dockerfile.py / Tests / deploy scripts '''
return 'v4.1.1'
return __version__
@pytest.fixture(scope='module')
def persist_args(request):