]> git.ipfire.org Git - thirdparty/pdns.git/blame - Dockerfile-dnsdist
codeql workflow: set ubuntu mirror
[thirdparty/pdns.git] / Dockerfile-dnsdist
CommitLineData
c0e0545b 1# our chosen base image
d233e568 2FROM debian:11-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
17RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/dnsdist/debian-buster/control && \
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
PD
42
43RUN mkdir /build && \
1e9b17d7 44 LUAVER=$([ -z "${NO_LUA_JIT##*$(dpkg --print-architecture)*}" ] && echo 'lua5.3' || echo 'luajit') && \
64d4a9d9
JC
45 ./configure \
46 --with-lua=${LUAVER} \
c0e0545b
PD
47 LDFLAGS=-rdynamic \
48 --sysconfdir=/etc/dnsdist \
49 --enable-option-checking=fatal \
50 --enable-dnscrypt \
51 --enable-dns-over-tls \
52 --enable-dns-over-https \
53 --with-re2 && \
54 make clean && \
55 make $MAKEFLAGS install DESTDIR=/build && make clean && \
56 strip /build/usr/local/bin/*
57RUN cd /tmp && mkdir /build/tmp/ && mkdir debian && \
7b968335 58 echo 'Source: docker-deps-for-pdns' > debian/control && \
c0e0545b
PD
59 dpkg-shlibdeps /build/usr/local/bin/dnsdist && \
60 sed 's/^shlibs:Depends=/Depends: /' debian/substvars >> debian/control && \
61 equivs-build debian/control && \
62 dpkg-deb -I equivs-dummy_1.0_all.deb && cp equivs-dummy_1.0_all.deb /build/tmp/
63
64# Runtime
65
d233e568 66FROM debian:11-slim
c0e0545b
PD
67
68# Reusable layer for base update - Should be cached from builder
69RUN apt-get update && apt-get -y dist-upgrade && apt-get clean
70
6c1e69e0
PL
71# Ensure python3 and jinja2 is present (for startup script), and python3-atomicwrites (for backend management), and tini (for signal management)
72RUN apt-get install -y python3 python3-jinja2 python3-atomicwrites tini libcap2-bin && apt-get clean
c0e0545b
PD
73
74# Output from builder
75COPY --from=builder /build /
76RUN chmod 1777 /tmp # FIXME: better not use /build/tmp for equivs at all
c0e0545b
PD
77
78# Ensure dependencies are present
2e209af7 79RUN apt-get install -y /tmp/equivs-dummy_1.0_all.deb && apt-get clean
c0e0545b
PD
80
81# Config
6c1e69e0 82RUN mkdir -p /etc/dnsdist/conf.d /etc/dnsdist/templates.d
d2a1e0c6 83COPY dockerdata/dnsdist.conf /etc/dnsdist/
c0e0545b
PD
84
85# Start script
86COPY dockerdata/startup.py /usr/local/bin/dnsdist-startup
87
88# Work with pdns user - not root
89RUN adduser --system --disabled-password --disabled-login --no-create-home --group pdns --uid 953
6c1e69e0 90RUN chown pdns:pdns /etc/dnsdist/conf.d /etc/dnsdist/templates.d
c0e0545b
PD
91USER pdns
92
3d30a064 93# Default DNS ports
c0e0545b
PD
94EXPOSE 53/udp
95EXPOSE 53/tcp
3d30a064 96# Default console port
c0e0545b 97EXPOSE 5199/tcp
3d30a064 98# Default webserver port
c0e0545b
PD
99EXPOSE 8083/tcp
100
101WORKDIR /etc/dnsdist
102
d2a1e0c6
PL
103COPY dockerdata/dnsdist-resolver.lua /etc/dnsdist/
104COPY dockerdata/dnsdist-resolver.py /usr/local/bin/dnsdist-resolver
c0e0545b
PD
105
106ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/dnsdist-startup"]