From: Pieter Lexis Date: Mon, 9 Nov 2020 19:06:18 +0000 (+0100) Subject: Docker: ensure caching works X-Git-Tag: dnsdist-1.6.0-alpha0~10^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F9694%2Fhead;p=thirdparty%2Fpdns.git Docker: ensure caching works --- diff --git a/Dockerfile-auth b/Dockerfile-auth index ed18566086..42bdf88e2f 100644 --- a/Dockerfile-auth +++ b/Dockerfile-auth @@ -10,7 +10,7 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get clean RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends devscripts equivs git && apt-get clean # import everything - this could be pdns.git OR an auth tarball! -COPY . /source +COPY builder-support /source/builder-support # TODO: control file is not in tarballs at all right now RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/authoritative/debian-buster/control && \ @@ -19,6 +19,16 @@ RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-instal # build and install (TODO: before we hit this line, rearrange /source structure if we are coming from a tarball) WORKDIR /source/ +COPY pdns /source/pdns +COPY modules /source/modules +COPY codedocs /source/codedocs +COPY docs /source/docs +COPY build-aux /source/build-aux +COPY m4 /source/m4 +COPY ext /source/ext +COPY .git /source/.git +ADD configure.ac Makefile.am /source/ + ARG MAKEFLAGS= ENV MAKEFLAGS ${MAKEFLAGS:--j2} @@ -64,9 +74,7 @@ RUN apt install -y /tmp/equivs-dummy_1.0_all.deb && apt clean # Start script COPY dockerdata/startup.py /usr/local/sbin/pdns_server-startup -# Config file(s) from builder -# Should not grab this from builder - since it isn't being built -COPY --from=builder /source/dockerdata/pdns.conf /etc/powerdns/ +COPY dockerdata/pdns.conf /etc/powerdns/ RUN mkdir -p /etc/powerdns/pdns.d /var/run/pdns /var/lib/powerdns /etc/powerdns/templates.d # Work with pdns user - not root diff --git a/Dockerfile-dnsdist b/Dockerfile-dnsdist index 98bdf0d272..75dab70de0 100644 --- a/Dockerfile-dnsdist +++ b/Dockerfile-dnsdist @@ -9,13 +9,18 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get clean # devscripts gives us mk-build-deps (and a lot of other stuff) RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends devscripts equivs git && apt-get clean -# import everything - this could be pdns.git OR a dnsdist tarball! -COPY . /source +COPY builder-support /source/builder-support # TODO: control file is not in tarballs at all right now RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/dnsdist/debian-buster/control && \ apt-get clean +COPY pdns /source/pdns +COPY build-aux /source/build-aux +COPY m4 /source/m4 +COPY ext /source/ext +COPY .git /source/.git + # build and install (TODO: before we hit this line, rearrange /source structure if we are coming from a tarball) WORKDIR /source/pdns/dnsdistdist @@ -66,7 +71,7 @@ RUN apt install -y /tmp/equivs-dummy_1.0_all.deb && apt clean # Config RUN mkdir -p /etc/dnsdist/conf.d /etc/dnsdist/templates.d -COPY --from=builder /source/dockerdata/dnsdist.conf /etc/dnsdist/ +COPY dockerdata/dnsdist.conf /etc/dnsdist/ # Start script COPY dockerdata/startup.py /usr/local/bin/dnsdist-startup @@ -86,7 +91,7 @@ EXPOSE 8083/tcp WORKDIR /etc/dnsdist -COPY --from=builder /source/dockerdata/dnsdist-resolver.lua /etc/dnsdist/ -COPY --from=builder /source/dockerdata/dnsdist-resolver.py /usr/local/bin/dnsdist-resolver +COPY dockerdata/dnsdist-resolver.lua /etc/dnsdist/ +COPY dockerdata/dnsdist-resolver.py /usr/local/bin/dnsdist-resolver ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/dnsdist-startup"] diff --git a/Dockerfile-recursor b/Dockerfile-recursor index 57bf9a2506..268417bb09 100644 --- a/Dockerfile-recursor +++ b/Dockerfile-recursor @@ -13,16 +13,19 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get clean # devscripts gives us mk-build-deps (and a lot of other stuff) RUN apt-get install -y --no-install-recommends devscripts equivs git curl && apt-get clean -# import everything - this could be pdns.git OR a recursor tarball! -COPY . /source - -# TODO: make sure /source looks roughly the same from git or tar +COPY builder-support /source/builder-support # TODO: control file is not in tarballs at all right now RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/recursor/debian-buster/control && \ apt-get clean # RUN apt-get -y install protobuf-compiler && apt-get clean +COPY pdns /source/pdns +COPY build-aux /source/build-aux +COPY m4 /source/m4 +COPY ext /source/ext +COPY .git /source/.git + # build and install (TODO: before we hit this line, rearrange /source structure if we are coming from a tarball) WORKDIR /source/pdns/recursordist @@ -74,8 +77,7 @@ RUN apt install -y /tmp/equivs-dummy_1.0_all.deb && apt clean COPY dockerdata/startup.py /usr/local/sbin/pdns_recursor-startup # Config file(s) from builder -# Should not grab this from builder - since it isn't being built -COPY --from=builder /source/dockerdata/recursor.conf /etc/powerdns/ +COPY dockerdata/recursor.conf /etc/powerdns/ # Is recursor.d necessary if we copy the config into recursor.conf? (see above) RUN mkdir -p /etc/powerdns/recursor.d /var/run/pdns-recursor /etc/powerdns/templates.d diff --git a/Makefile.docker b/Makefile.docker index 195f88c42e..e882a1eb79 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -1,15 +1,22 @@ -.PHONY: all build build-nocache dep +.PHONY: all build build-nocache dep auth recursor dnsdist VERSION=experimental REVISION=1 all: build -build: +auth: docker build --build-arg VERSION=$(VERSION) -t powerdns/pdns-auth-master:$(VERSION)-$(REVISION) --rm -f Dockerfile-auth . + +recursor: docker build --build-arg VERSION=$(VERSION) -t powerdns/pdns-recursor-master:$(VERSION)-$(REVISION) --rm -f Dockerfile-recursor . + +dnsdist: docker build --build-arg VERSION=$(VERSION) -t powerdns/dnsdist-master:$(VERSION)-$(REVISION) --rm -f Dockerfile-dnsdist . +build: auth recursor dnsdist + @true + build-nocache: docker build --build-arg VERSION=$(VERSION) -t powerdns/pdns-auth-master:$(VERSION)-$(REVISION) --no-cache --rm -f Dockerfile-auth . docker build --build-arg VERSION=$(VERSION) -t powerdns/pdns-recursor-master:$(VERSION)-$(REVISION) --no-cache --rm -f Dockerfile-recursor .