Added .include_if_exists into Dockerfile.in
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Wed, 08 Apr 2015 21:58:06 +0200
changeset 5 3e135449f797
parent 4 992c1b212004
child 6 a94233c4e86a
Added .include_if_exists into Dockerfile.in
.hgignore
build
docker.env.ex
platforms/Makefile
platforms/debian7/Dockerfile
platforms/debian7/Dockerfile.in
platforms/debian8/Dockerfile
platforms/debian8/Dockerfile.in
platforms/fedora21/Dockerfile
platforms/fedora21/Dockerfile.in
platforms/opensuse/Dockerfile
platforms/opensuse/Dockerfile.in
scripts/din2d
--- a/.hgignore	Tue Apr 07 21:08:49 2015 +0200
+++ b/.hgignore	Wed Apr 08 21:58:06 2015 +0200
@@ -1,1 +1,2 @@
 exim/
+docker.env
--- a/build	Tue Apr 07 21:08:49 2015 +0200
+++ b/build	Wed Apr 08 21:58:06 2015 +0200
@@ -1,7 +1,9 @@
 #!/bin/bash
+make -C platforms
 set -e
 test -d exim || {
     echo "exim src directory missing" >&2
+    echo "try: git clone https://github.com/Exim/exim.git" >&2
     exit 1
 }
 for dockerfile in ${*:-platforms/*/Dockerfile}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docker.env.ex	Wed Apr 08 21:58:06 2015 +0200
@@ -0,0 +1,5 @@
+# this is a file to be included in the
+# generated Dockerfiles via
+# .include_if_exists
+#
+# ENV http_proxy http://172.17.42.1:3128/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/Makefile	Wed Apr 08 21:58:06 2015 +0200
@@ -0,0 +1,10 @@
+dockerfiles_in = ${wildcard */Dockerfile.in}
+dockerfiles = ${dockerfiles_in:.in=}
+
+.PHONY:	all clean
+
+all:	${dockerfiles}
+clean:	; -rm -f ${dockerfiles}
+
+%:	%.in
+	../scripts/din2d $< >$@
--- a/platforms/debian7/Dockerfile	Tue Apr 07 21:08:49 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-FROM debian:7
-
-ENV http_proxy http://172.17.42.1:3128/
-ENV DEBIAN_FRONTEND noninteractive 
-
-RUN \
- apt-get update && \
- apt-get upgrade -y && \
- apt-get dist-upgrade -y && \
- apt-get install --no-install-recommends -y \
- procps git gcc make pkg-config \
- libpcre3-dev libssl-dev libdb5.1-dev libmysqlclient-dev libpq-dev \
- libsqlite3-dev libldap2-dev libperl-dev autoconf \
- sudo net-tools \
- less
-
-# prepare user environment for running (exim) and testing exim (eximtest)
-RUN useradd --system -c 'Exim User' exim
-RUN useradd --home-dir /home/eximtest -G exim -c 'Exim Test User' -m eximtest
-
-# add additional files
-# (sudoers, Local/Makefile)
-COPY platforms/debian7/root/ /
-
-# add current working copy
-COPY exim/ /home/eximtest/exim/
-
-# prepare the build - files need to be owned
-# by eximtest
-WORKDIR /home/eximtest
-RUN chown -R eximtest: .
-
-# Build Exim
-USER eximtest
-WORKDIR /home/eximtest/exim/src
-RUN make -j -l 1 
-
-
-# Prepare/Build the test-suite
-WORKDIR /home/eximtest/exim/test
-RUN mkdir /tmp/exim
-RUN echo $PWD/test-config > /tmp/exim/trusted-configs
-RUN autoconf
-RUN ./configure
-RUN make
-
-## now finally run the tests
-## should be done by you, manually :)
-# -> full hostname
-
-ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", \
-    "-FLAVOUR", "debian7"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/debian7/Dockerfile.in	Wed Apr 08 21:58:06 2015 +0200
@@ -0,0 +1,53 @@
+FROM debian:7
+
+.include_if_exists ../../docker.env
+ENV http_proxy http://172.17.42.1:3128/
+ENV DEBIAN_FRONTEND noninteractive 
+
+RUN \
+ apt-get update && \
+ apt-get upgrade -y && \
+ apt-get dist-upgrade -y && \
+ apt-get install --no-install-recommends -y \
+ procps git gcc make pkg-config \
+ libpcre3-dev libssl-dev libdb5.1-dev libmysqlclient-dev libpq-dev \
+ libsqlite3-dev libldap2-dev libperl-dev autoconf \
+ sudo net-tools \
+ less
+
+# prepare user environment for running (exim) and testing exim (eximtest)
+RUN useradd --system -c 'Exim User' exim
+RUN useradd --home-dir /home/eximtest -G exim -c 'Exim Test User' -m eximtest
+
+# add additional files
+# (sudoers, Local/Makefile)
+COPY platforms/debian7/root/ /
+
+# add current working copy
+COPY exim/ /home/eximtest/exim/
+
+# prepare the build - files need to be owned
+# by eximtest
+WORKDIR /home/eximtest
+RUN chown -R eximtest: .
+
+# Build Exim
+USER eximtest
+WORKDIR /home/eximtest/exim/src
+RUN make -j -l 1 
+
+
+# Prepare/Build the test-suite
+WORKDIR /home/eximtest/exim/test
+RUN mkdir /tmp/exim
+RUN echo $PWD/test-config > /tmp/exim/trusted-configs
+RUN autoconf
+RUN ./configure
+RUN make
+
+## now finally run the tests
+## should be done by you, manually :)
+# -> full hostname
+
+ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", \
+    "-FLAVOUR", "debian7"]
--- a/platforms/debian8/Dockerfile	Tue Apr 07 21:08:49 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-FROM debian:8
-
-ENV http_proxy http://172.17.42.1:3128/
-ENV DEBIAN_FRONTEND noninteractive 
-
-RUN \
- apt-get update && \
- apt-get upgrade -y && \
- apt-get dist-upgrade -y && \
- apt-get install --no-install-recommends -y \
- git gcc make pkg-config \
- libpcre3-dev libssl-dev libdb5.3-dev libmysqlclient-dev libpq-dev \
- libsqlite3-dev libldap2-dev libperl-dev autoconf \
- sudo net-tools \
- less
-
-# prepare user environment for running (exim) and testing exim (eximtest)
-RUN useradd --system -c 'Exim User' exim
-RUN useradd --home-dir /home/eximtest -G exim -c 'Exim Test User' -m eximtest
-
-# add additional files
-# (sudoers, Local/Makefile)
-COPY platforms/debian8/root/ /
-
-# add current working copy
-COPY exim/ /home/eximtest/exim/
-
-# prepare the build - files need to be owned
-# by eximtest
-WORKDIR /home/eximtest
-RUN chown -R eximtest: .
-
-# Build Exim
-USER eximtest
-WORKDIR /home/eximtest/exim/src
-RUN make -j -l 1
-
-
-# Prepare/Build the test-suite
-WORKDIR /home/eximtest/exim/test
-RUN mkdir /tmp/exim
-RUN echo $PWD/test-config > /tmp/exim/trusted-configs
-RUN autoconf
-RUN ./configure
-RUN make
-
-## now finally run the tests
-## should be done by you, manually :)
-# -> full hostname
-
-ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", "-FLAVOUR", "debian8"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/debian8/Dockerfile.in	Wed Apr 08 21:58:06 2015 +0200
@@ -0,0 +1,51 @@
+FROM debian:8
+
+.include_if_exists ../../docker.env
+ENV DEBIAN_FRONTEND noninteractive 
+
+RUN \
+ apt-get update && \
+ apt-get upgrade -y && \
+ apt-get dist-upgrade -y && \
+ apt-get install --no-install-recommends -y \
+ git gcc make pkg-config \
+ libpcre3-dev libssl-dev libdb5.3-dev libmysqlclient-dev libpq-dev \
+ libsqlite3-dev libldap2-dev libperl-dev autoconf \
+ sudo net-tools \
+ less
+
+# prepare user environment for running (exim) and testing exim (eximtest)
+RUN useradd --system -c 'Exim User' exim
+RUN useradd --home-dir /home/eximtest -G exim -c 'Exim Test User' -m eximtest
+
+# add additional files
+# (sudoers, Local/Makefile)
+COPY platforms/debian8/root/ /
+
+# add current working copy
+COPY exim/ /home/eximtest/exim/
+
+# prepare the build - files need to be owned
+# by eximtest
+WORKDIR /home/eximtest
+RUN chown -R eximtest: .
+
+# Build Exim
+USER eximtest
+WORKDIR /home/eximtest/exim/src
+RUN make -j -l 1
+
+
+# Prepare/Build the test-suite
+WORKDIR /home/eximtest/exim/test
+RUN mkdir /tmp/exim
+RUN echo $PWD/test-config > /tmp/exim/trusted-configs
+RUN autoconf
+RUN ./configure
+RUN make
+
+## now finally run the tests
+## should be done by you, manually :)
+# -> full hostname
+
+ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", "-FLAVOUR", "debian8"]
--- a/platforms/fedora21/Dockerfile	Tue Apr 07 21:08:49 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-FROM fedora:21
-
-ENV http_proxy http://172.17.42.1:3128/
-ENV DEBIAN_FRONTEND noninteractive 
-
-#RUN yum -y install deltarpm
-RUN yum -y update
-RUN yum -y install git gcc make
-RUN yum -y install pcre-devel openssl-devel libdb-devel 
-RUN yum -y install community-mysql-devel postgresql-devel 
-RUN yum -y install sqlite-devel openldap-devel perl-devel 
-RUN yum -y install autoconf sudo less net-tools
-Run yum -y install perl-ExtUtils-Embed 
-
-# prepare user environment for running (exim) and testing exim (eximtest)
-RUN useradd --system -c 'Exim User' exim
-RUN useradd --home-dir /home/eximtest -G exim -c 'Exim Test User' -m eximtest
-
-# add additional files
-# (sudoers, Local/Makefile)
-COPY platforms/fedora21/root/ /
-
-# add current working copy
-COPY exim/ /home/eximtest/exim/
-
-# prepare the build - files need to be owned
-# by eximtest
-WORKDIR /home/eximtest
-RUN chown -R eximtest: .
-
-# Build Exim
-USER eximtest
-WORKDIR /home/eximtest/exim/src
-RUN make -j -l 1
-
-
-# Prepare/Build the test-suite
-WORKDIR /home/eximtest/exim/test
-RUN mkdir /tmp/exim
-RUN echo $PWD/test-config > /tmp/exim/trusted-configs
-RUN autoconf
-RUN ./configure
-RUN make
-
-## now finally run the tests
-## should be done by you, manually :)
-# -> full hostname
-
-ENV PATH=/sbin:$PATH
-ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", "-FLAVOUR", "fedora21"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/fedora21/Dockerfile.in	Wed Apr 08 21:58:06 2015 +0200
@@ -0,0 +1,49 @@
+FROM fedora:21
+
+.include_if_exists ../../docker.env
+
+#RUN yum -y install deltarpm
+RUN yum -y update
+RUN yum -y install git gcc make
+RUN yum -y install pcre-devel openssl-devel libdb-devel 
+RUN yum -y install community-mysql-devel postgresql-devel 
+RUN yum -y install sqlite-devel openldap-devel perl-devel 
+RUN yum -y install autoconf sudo less net-tools
+Run yum -y install perl-ExtUtils-Embed 
+
+# prepare user environment for running (exim) and testing exim (eximtest)
+RUN useradd --system -c 'Exim User' exim
+RUN useradd --home-dir /home/eximtest -G exim -c 'Exim Test User' -m eximtest
+
+# add additional files
+# (sudoers, Local/Makefile)
+COPY platforms/fedora21/root/ /
+
+# add current working copy
+COPY exim/ /home/eximtest/exim/
+
+# prepare the build - files need to be owned
+# by eximtest
+WORKDIR /home/eximtest
+RUN chown -R eximtest: .
+
+# Build Exim
+USER eximtest
+WORKDIR /home/eximtest/exim/src
+RUN make -j -l 1
+
+
+# Prepare/Build the test-suite
+WORKDIR /home/eximtest/exim/test
+RUN mkdir /tmp/exim
+RUN echo $PWD/test-config > /tmp/exim/trusted-configs
+RUN autoconf
+RUN ./configure
+RUN make
+
+## now finally run the tests
+## should be done by you, manually :)
+# -> full hostname
+
+ENV PATH=/sbin:$PATH
+ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", "-FLAVOUR", "fedora21"]
--- a/platforms/opensuse/Dockerfile	Tue Apr 07 21:08:49 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-FROM opensuse
-ENV http_proxy http://172.17.42.1:3128/
-
-#RUN zypper -y install deltarpm
-RUN zypper --gpg-auto-import-keys -n update 
-RUN zypper -n install --no-recommends git gcc make
-RUN zypper -n install --no-recommends pcre-devel openssl-devel libdb-4_8-devel
-RUN zypper -n install --no-recommends mysql-devel postgresql-devel 
-RUN zypper -n install --no-recommends sqlite-devel openldap2-devel 
-RUN zypper -n install --no-recommends autoconf sudo less net-tools
-
-# prepare user environment for running (exim) and testing exim (eximtest)
-RUN groupadd --system exim
-RUN useradd --system -g exim -c 'Exim User' exim
-RUN groupadd eximtest
-RUN useradd --home-dir /home/eximtest -g eximtest -G exim -c 'Exim Test User' -m eximtest
-
-# add additional files
-# (sudoers, Local/Makefile)
-COPY platforms/opensuse/root/ /
-
-# add current working copy
-COPY exim/ /home/eximtest/exim/
-
-# prepare the build - files need to be owned
-# by eximtest
-WORKDIR /home/eximtest
-RUN chown -R eximtest: .
-
-# Build Exim
-USER eximtest
-WORKDIR /home/eximtest/exim/src
-RUN make -j -l 1
-
-
-# Prepare/Build the test-suite
-WORKDIR /home/eximtest/exim/test
-RUN mkdir /tmp/exim
-RUN echo $PWD/test-config > /tmp/exim/trusted-configs
-RUN autoconf
-RUN ./configure
-RUN make
-
-## now finally run the tests
-## should be done by you, manually :)
-# -> full hostname
-
-ENV PATH=/sbin:$PATH
-ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", "-FLAVOUR", "opensuse"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/opensuse/Dockerfile.in	Wed Apr 08 21:58:06 2015 +0200
@@ -0,0 +1,50 @@
+FROM opensuse
+
+.include_if_exists ../../docker.env
+
+#RUN zypper -y install deltarpm
+RUN zypper --gpg-auto-import-keys -n update 
+RUN zypper -n install --no-recommends git gcc make
+RUN zypper -n install --no-recommends pcre-devel openssl-devel libdb-4_8-devel
+RUN zypper -n install --no-recommends mysql-devel postgresql-devel 
+RUN zypper -n install --no-recommends sqlite-devel openldap2-devel 
+RUN zypper -n install --no-recommends autoconf sudo less net-tools
+
+# prepare user environment for running (exim) and testing exim (eximtest)
+RUN groupadd --system exim
+RUN useradd --system -g exim -c 'Exim User' exim
+RUN groupadd eximtest
+RUN useradd --home-dir /home/eximtest -g eximtest -G exim -c 'Exim Test User' -m eximtest
+
+# add additional files
+# (sudoers, Local/Makefile)
+COPY platforms/opensuse/root/ /
+
+# add current working copy
+COPY exim/ /home/eximtest/exim/
+
+# prepare the build - files need to be owned
+# by eximtest
+WORKDIR /home/eximtest
+RUN chown -R eximtest: .
+
+# Build Exim
+USER eximtest
+WORKDIR /home/eximtest/exim/src
+RUN make -j -l 1
+
+
+# Prepare/Build the test-suite
+WORKDIR /home/eximtest/exim/test
+RUN mkdir /tmp/exim
+RUN echo $PWD/test-config > /tmp/exim/trusted-configs
+RUN autoconf
+RUN ./configure
+RUN make
+
+## now finally run the tests
+## should be done by you, manually :)
+# -> full hostname
+
+ENV PATH=/sbin:$PATH
+ENTRYPOINT ["./runtest", "../src/build-Linux-x86_64/exim", "-FLAVOUR", "opensuse"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/din2d	Wed Apr 08 21:58:06 2015 +0200
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+# Dockerfile.in -> Dockerfile
+# currently just resolve .include ..
+
+use strict;
+use warnings;
+use Cwd qw(abs_path);
+use File::Basename qw(dirname);
+use Getopt::Long;
+
+while (<>) {
+    /^\.include_if_exists\s+(.+?)\s*$/ or next;
+    $_ = "# from $1 {{\n" . do { 
+	my $file = abs_path(dirname($ARGV) . "/$1");
+	open(my $in, '<', $file) or die "Can't open $file: $!\n";
+	local $/ = undef;
+	<$in>;
+    } 
+    . "# }}\n";
+}
+continue {
+    print if defined;
+}