|
| 1 | +ARG BASE=public.ecr.aws/ubuntu/ubuntu:24.04 |
| 2 | + |
| 3 | +ARG DNSDIST_VERSION=1.9.8 |
| 4 | +# dnsdist=1.9.8 does not support quiche>=0.23 |
| 5 | +ARG QUICHE_VERSION=0.22.0 |
| 6 | +ARG QUICHE_SHA256SUM=0af8744b07038ee4af8cdb94dd4c11f1a730001944a0ef2f3f03e63715b15268 |
| 7 | + |
| 8 | +### |
| 9 | + |
| 10 | +FROM $BASE AS download-base |
| 11 | +WORKDIR /download |
| 12 | + |
| 13 | +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 14 | + ca-certificates curl gnupg |
| 15 | + |
| 16 | +### |
| 17 | + |
| 18 | +FROM download-base AS download-dnsdist |
| 19 | + |
| 20 | +ARG DNSDIST_VERSION |
| 21 | +RUN curl -sSf "https://downloads.powerdns.com/releases/dnsdist-${DNSDIST_VERSION}.tar.bz2" -o dnsdist.tar.bz2 |
| 22 | +RUN curl -sSf "https://downloads.powerdns.com/releases/dnsdist-${DNSDIST_VERSION}.tar.bz2.asc" -o dnsdist.tar.bz2.asc |
| 23 | + |
| 24 | +COPY ./dnsdist.asc ./ |
| 25 | +RUN gpg --no-default-keyring --keyring dnsdist --import ./dnsdist.asc |
| 26 | +RUN gpg --no-default-keyring --keyring dnsdist --verify dnsdist.tar.bz2.asc dnsdist.tar.bz2 |
| 27 | + |
| 28 | +### |
| 29 | + |
| 30 | +FROM download-base AS download-quiche |
| 31 | + |
| 32 | +ARG QUICHE_VERSION |
| 33 | +ARG QUICHE_SHA256SUM |
| 34 | +RUN curl -sSfL "https://github.com/cloudflare/quiche/archive/refs/tags/${QUICHE_VERSION}.tar.gz" -o quiche.tar.gz |
| 35 | +RUN echo "${QUICHE_SHA256SUM} quiche.tar.gz" | sha256sum -c |
| 36 | + |
| 37 | +### |
| 38 | + |
| 39 | +FROM public.ecr.aws/docker/library/rust:1.85.0-bookworm AS build-quiche |
| 40 | + |
| 41 | +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 42 | + cmake clang |
| 43 | + |
| 44 | +WORKDIR /build |
| 45 | + |
| 46 | +RUN --mount=type=bind,from=download-quiche,source=/download,target=/download \ |
| 47 | + tar xf /download/quiche.tar.gz --strip=1 |
| 48 | +RUN cargo build -p quiche --features=ffi,boringssl-boring-crate --release |
| 49 | + |
| 50 | +ARG QUICHE_VERSION |
| 51 | +COPY ./quiche.pc.inc . |
| 52 | +RUN sed -e "s|@QUICHE_VERSION@|${QUICHE_VERSION}|" <quiche.pc.inc >quiche.pc |
| 53 | + |
| 54 | +RUN install -D target/release/libquiche.so /opt/quiche/lib/libquiche.so.${QUICHE_VERSION} && \ |
| 55 | + install -D -t /opt/quiche/include quiche/include/quiche.h && \ |
| 56 | + install -D -t /opt/quiche/lib/pkgconfig quiche.pc && \ |
| 57 | + ldconfig -n /opt/quiche/lib |
| 58 | + |
| 59 | +### |
| 60 | + |
| 61 | +FROM $BASE AS build-dnsdist |
| 62 | + |
| 63 | +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 64 | + build-essential lbzip2 gawk libboost-all-dev libcap-dev libcdb-dev libcrypt-dev libedit-dev libfstrm-dev liblmdb-dev libluajit-5.1-dev libnghttp2-dev libre2-dev libssl-dev |
| 65 | + |
| 66 | +WORKDIR /build |
| 67 | + |
| 68 | +RUN --mount=type=bind,from=download-dnsdist,source=/download,target=/download \ |
| 69 | + tar xf /download/dnsdist.tar.bz2 --strip=1 |
| 70 | + |
| 71 | +RUN --mount=type=bind,from=build-quiche,source=/opt/quiche,target=/opt/quiche \ |
| 72 | + PKG_CONFIG_PATH=/opt/quiche/lib/pkgconfig ./configure --prefix=/opt/dnsdist --enable-dns-over-tls --enable-dns-over-https --enable-dns-over-quic --enable-dns-over-http3 --enable-dnstap --with-gnutls=no --with-re2 --with-cdb |
| 73 | + |
| 74 | +RUN --mount=type=bind,from=build-quiche,source=/opt/quiche,target=/opt/quiche \ |
| 75 | + make -j"$(nproc)" install |
| 76 | + |
| 77 | +RUN --mount=type=bind,from=build-quiche,source=/opt/quiche,target=/opt/quiche \ |
| 78 | + LD_LIBRARY_PATH=/opt/quiche/lib ldd /opt/dnsdist/bin/dnsdist | \ |
| 79 | + gawk 'match($0, /=> (\/lib\/[^ ]+)/, m) { print "/usr"m[1] }' | \ |
| 80 | + xargs dpkg -S | gawk 'match($0, /^(.*): /, m) { print m[1] }' >deps.txt |
| 81 | + |
| 82 | +### |
| 83 | + |
| 84 | +FROM $BASE |
| 85 | + |
| 86 | +RUN --mount=type=bind,from=build-dnsdist,source=/build,target=/build \ |
| 87 | + apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 88 | + dumb-init $(cat /build/deps.txt) && \ |
| 89 | + rm -rf /var/lib/apt/lists/* |
| 90 | + |
| 91 | +COPY --from=build-quiche /opt/quiche /opt/quiche |
| 92 | +COPY --from=build-dnsdist /opt/dnsdist /opt/dnsdist |
| 93 | +RUN ldconfig /opt/*/lib |
| 94 | + |
| 95 | +COPY --chmod=755 entrypoint.sh / |
| 96 | + |
| 97 | +RUN ldd /opt/dnsdist/bin/dnsdist |
| 98 | + |
| 99 | +ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments