]> git.ipfire.org Git - thirdparty/pdns.git/blame - Dockerfile-dnsdist
Merge pull request #14078 from rgacogne/ddist-harvest-quic
[thirdparty/pdns.git] / Dockerfile-dnsdist
CommitLineData
c0e0545b 1# our chosen base image
cf66dd22 2FROM debian:12-slim AS builder
c0e0545b 3
1e9b17d7 4ENV NO_LUA_JIT="s390x arm64"
c1a8e298 5
c0e0545b
PD
6# TODO: make sure /source looks roughly the same from git or tar
7
8# Reusable layer for base update
9RUN apt-get update && apt-get -y dist-upgrade && apt-get clean
10
11# devscripts gives us mk-build-deps (and a lot of other stuff)
07c957db 12RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends devscripts equivs git && apt-get clean
c0e0545b 13
d2a1e0c6 14COPY builder-support /source/builder-support
c0e0545b
PD
15
16# TODO: control file is not in tarballs at all right now
cf66dd22 17RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/dnsdist/debian-bookworm/control && \
c0e0545b
PD
18 apt-get clean
19
d2a1e0c6
PL
20COPY pdns /source/pdns
21COPY build-aux /source/build-aux
22COPY m4 /source/m4
23COPY ext /source/ext
ff6b244a 24COPY builder/helpers/set-configure-ac-version.sh /usr/local/bin
d2a1e0c6
PL
25COPY .git /source/.git
26
c0e0545b
PD
27# build and install (TODO: before we hit this line, rearrange /source structure if we are coming from a tarball)
28WORKDIR /source/pdns/dnsdistdist
29
30ARG MAKEFLAGS=
31ENV MAKEFLAGS ${MAKEFLAGS:--j2}
32
ff6b244a
PL
33ARG DOCKER_FAKE_RELEASE=NO
34ENV DOCKER_FAKE_RELEASE ${DOCKER_FAKE_RELEASE}
35
c0e0545b
PD
36RUN touch dnsdist.1 # avoid having to install pandoc and venv
37
ff6b244a 38RUN if [ "${DOCKER_FAKE_RELEASE}" = "YES" ]; then \
a508963d 39 BUILDER_VERSION="$(IS_RELEASE=YES BUILDER_MODULES=dnsdist ./builder-support/gen-version | sed 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\(\(alpha|beta|rc\)\d\+\)\)?.*/\1/')" set-configure-ac-version.sh;\
ff6b244a
PL
40 fi && \
41 BUILDER_MODULES=dnsdist autoreconf -vfi
c0e0545b 42
de02bfc1
PD
43
44RUN mkdir /libh2o && cd /libh2o && \
4ccb0f78
RG
45 apt-get update && apt-get install -y cmake curl jq libssl-dev zlib1g-dev && \
46 cd /source/builder-support/helpers/ && \
47 ./install_h2o.sh
de02bfc1 48
9a5fe194 49RUN mkdir /quiche && cd /quiche && \
50 apt-get install -y libclang-dev && \
51 apt-get clean && \
4ccb0f78
RG
52 cd /source/builder-support/helpers/ && \
53 ./install_rust.sh && \
54 ./install_quiche.sh
9a5fe194 55
c0e0545b 56RUN mkdir /build && \
1e9b17d7 57 LUAVER=$([ -z "${NO_LUA_JIT##*$(dpkg --print-architecture)*}" ] && echo 'lua5.3' || echo 'luajit') && \
64d4a9d9
JC
58 ./configure \
59 --with-lua=${LUAVER} \
c0e0545b
PD
60 LDFLAGS=-rdynamic \
61 --sysconfdir=/etc/dnsdist \
62 --enable-option-checking=fatal \
63 --enable-dnscrypt \
64 --enable-dns-over-tls \
65 --enable-dns-over-https \
de02bfc1
PD
66 --with-re2 \
67 --with-h2o \
9a5fe194 68 --enable-dns-over-quic \
69 --enable-dns-over-http3 \
70 --with-quiche \
de02bfc1 71 PKG_CONFIG_PATH=/opt/lib/pkgconfig && \
c0e0545b
PD
72 make clean && \
73 make $MAKEFLAGS install DESTDIR=/build && make clean && \
9a5fe194 74 strip /build/usr/local/bin/* &&\
75 mkdir -p /build/usr/lib/ && \
76 cp -rf /usr/lib/libdnsdist-quiche.so /build/usr/lib/
77
c0e0545b 78RUN cd /tmp && mkdir /build/tmp/ && mkdir debian && \
7b968335 79 echo 'Source: docker-deps-for-pdns' > debian/control && \
c0e0545b
PD
80 dpkg-shlibdeps /build/usr/local/bin/dnsdist && \
81 sed 's/^shlibs:Depends=/Depends: /' debian/substvars >> debian/control && \
82 equivs-build debian/control && \
83 dpkg-deb -I equivs-dummy_1.0_all.deb && cp equivs-dummy_1.0_all.deb /build/tmp/
84
85# Runtime
86
cf66dd22 87FROM debian:12-slim
c0e0545b
PD
88
89# Reusable layer for base update - Should be cached from builder
90RUN apt-get update && apt-get -y dist-upgrade && apt-get clean
91
d256ad02
PD
92# - python3 and jinja2 (for startup script)
93# - python3-atomicwrites (for backend management)
94# - tini (for signal management)
95# - ca-certificates (for verifying downstream DoH/DoT certificates)
96RUN apt-get install -y python3 python3-jinja2 python3-atomicwrites tini libcap2-bin ca-certificates && apt-get clean
c0e0545b
PD
97
98# Output from builder
99COPY --from=builder /build /
100RUN chmod 1777 /tmp # FIXME: better not use /build/tmp for equivs at all
c0e0545b
PD
101
102# Ensure dependencies are present
2e209af7 103RUN apt-get install -y /tmp/equivs-dummy_1.0_all.deb && apt-get clean
c0e0545b
PD
104
105# Config
6c1e69e0 106RUN mkdir -p /etc/dnsdist/conf.d /etc/dnsdist/templates.d
d2a1e0c6 107COPY dockerdata/dnsdist.conf /etc/dnsdist/
c0e0545b
PD
108
109# Start script
110COPY dockerdata/startup.py /usr/local/bin/dnsdist-startup
111
112# Work with pdns user - not root
113RUN adduser --system --disabled-password --disabled-login --no-create-home --group pdns --uid 953
6c1e69e0 114RUN chown pdns:pdns /etc/dnsdist/conf.d /etc/dnsdist/templates.d
c0e0545b
PD
115USER pdns
116
f28c81ed 117# Default DNS ports
c0e0545b
PD
118EXPOSE 53/udp
119EXPOSE 53/tcp
f28c81ed 120# Default console port
c0e0545b 121EXPOSE 5199/tcp
f28c81ed 122# Default webserver port
c0e0545b
PD
123EXPOSE 8083/tcp
124
125WORKDIR /etc/dnsdist
126
d2a1e0c6
PL
127COPY dockerdata/dnsdist-resolver.lua /etc/dnsdist/
128COPY dockerdata/dnsdist-resolver.py /usr/local/bin/dnsdist-resolver
c0e0545b
PD
129
130ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/dnsdist-startup"]