]> git.ipfire.org Git - thirdparty/pdns.git/blame - Dockerfile-auth
Meson: Fix lmdb-safe needs gettime
[thirdparty/pdns.git] / Dockerfile-auth
CommitLineData
c0e0545b 1# our chosen base image
a0d3acff 2FROM debian:11-slim AS builder
c0e0545b 3
1e9b17d7 4ENV NO_LUA_JIT="s390x arm64"
4e40df2e 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)
1af76fd8 12RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends devscripts dpkg-dev equivs git python3-venv && apt-get clean
c0e0545b
PD
13
14# import everything - this could be pdns.git OR an auth tarball!
d2a1e0c6 15COPY builder-support /source/builder-support
c0e0545b
PD
16
17# TODO: control file is not in tarballs at all right now
18RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/authoritative/debian-buster/control && \
19 apt-get clean
20
21# build and install (TODO: before we hit this line, rearrange /source structure if we are coming from a tarball)
22WORKDIR /source/
23
d2a1e0c6
PL
24COPY pdns /source/pdns
25COPY modules /source/modules
26COPY codedocs /source/codedocs
27COPY docs /source/docs
28COPY build-aux /source/build-aux
29COPY m4 /source/m4
30COPY ext /source/ext
31COPY .git /source/.git
32ADD configure.ac Makefile.am /source/
ff6b244a 33COPY builder/helpers/set-configure-ac-version.sh /usr/local/bin
d2a1e0c6 34
c0e0545b
PD
35ARG MAKEFLAGS=
36ENV MAKEFLAGS ${MAKEFLAGS:--j2}
37
ff6b244a
PL
38ARG DOCKER_FAKE_RELEASE=NO
39ENV DOCKER_FAKE_RELEASE ${DOCKER_FAKE_RELEASE}
40
41RUN if [ "${DOCKER_FAKE_RELEASE}" = "YES" ]; then \
a508963d 42 BUILDER_VERSION="$(IS_RELEASE=YES BUILDER_MODULES=authoritative ./builder-support/gen-version | sed 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\(\(alpha|beta|rc\)\d\+\)\)?.*/\1/')" set-configure-ac-version.sh;\
ff6b244a
PL
43 fi && \
44 BUILDER_MODULES=authoritative autoreconf -vfi
c0e0545b
PD
45
46# simplify repeated -C calls with SUBDIRS?
47RUN mkdir /build && \
1e9b17d7 48 LUAVER=$([ -z "${NO_LUA_JIT##*$(dpkg --print-architecture)*}" ] && echo 'lua5.3' || echo 'luajit') && \
64d4a9d9
JC
49 ./configure \
50 --with-lua=${LUAVER} \
c0e0545b
PD
51 --sysconfdir=/etc/powerdns \
52 --enable-option-checking=fatal \
9a205757 53 --with-dynmodules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe remote tinydns' \
c0e0545b 54 --enable-tools \
101701b8 55 --enable-ixfrdist \
1af76fd8 56 --with-unixodbc-lib=/usr/lib/$(dpkg-architecture -q DEB_BUILD_GNU_TYPE) && \
c0e0545b
PD
57 make clean && \
58 make $MAKEFLAGS -C ext && make $MAKEFLAGS -C modules && make $MAKEFLAGS -C pdns && \
59 make -C pdns install DESTDIR=/build && make -C modules install DESTDIR=/build && make clean && \
61f9a96f 60 strip /build/usr/local/bin/* /build/usr/local/sbin/* /build/usr/local/lib/pdns/*.so
c0e0545b 61RUN cd /tmp && mkdir /build/tmp/ && mkdir debian && \
7b968335 62 echo 'Source: docker-deps-for-pdns' > debian/control && \
c0e0545b
PD
63 dpkg-shlibdeps /build/usr/local/bin/* /build/usr/local/sbin/* /build/usr/local/lib/pdns/*.so && \
64 sed 's/^shlibs:Depends=/Depends: /' debian/substvars >> debian/control && \
65 equivs-build debian/control && \
66 dpkg-deb -I equivs-dummy_1.0_all.deb && cp equivs-dummy_1.0_all.deb /build/tmp/
67
68# Runtime
a0d3acff 69FROM debian:11-slim
c0e0545b
PD
70
71# Reusable layer for base update - Should be cached from builder
72RUN apt-get update && apt-get -y dist-upgrade && apt-get clean
73
005d1824 74# Ensure python3 and jinja2 is present (for startup script), and sqlite3 (for db schema), and tini (for signal management),
638d656c
NV
75# and vim (for pdnsutil edit-zone) , and supervisor (for special use cases requiring advanced process management)
76RUN apt-get install -y python3 python3-jinja2 sqlite3 tini libcap2-bin vim-tiny supervisor && apt-get clean
c0e0545b
PD
77
78# Output from builder
79COPY --from=builder /build /
80RUN chmod 1777 /tmp # FIXME: better not use /build/tmp for equivs at all
c0e0545b
PD
81
82# Ensure dependencies are present
2e209af7 83RUN apt-get install -y /tmp/equivs-dummy_1.0_all.deb && apt-get clean
c0e0545b
PD
84
85# Start script
86COPY dockerdata/startup.py /usr/local/sbin/pdns_server-startup
87
d2a1e0c6 88COPY dockerdata/pdns.conf /etc/powerdns/
6c1e69e0 89RUN mkdir -p /etc/powerdns/pdns.d /var/run/pdns /var/lib/powerdns /etc/powerdns/templates.d
c0e0545b
PD
90
91# Work with pdns user - not root
92RUN adduser --system --disabled-password --disabled-login --no-create-home --group pdns --uid 953
6c1e69e0 93RUN chown pdns:pdns /var/run/pdns /var/lib/powerdns /etc/powerdns/pdns.d /etc/powerdns/templates.d
c0e0545b
PD
94USER pdns
95
96# Set up database - this needs to be smarter
97RUN sqlite3 /var/lib/powerdns/pdns.sqlite3 < /usr/local/share/doc/pdns/schema.sqlite3.sql
98
f28c81ed 99# Default DNS ports
c0e0545b
PD
100EXPOSE 53/udp
101EXPOSE 53/tcp
f28c81ed 102# Default webserver port
c0e0545b
PD
103EXPOSE 8081/tcp
104
105ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/sbin/pdns_server-startup"]