1FROM debian:12 as build 2 3ARG NGHTTP2_BRANCH=master 4 5RUN apt-get update && \ 6 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ 7 git clang make binutils autoconf automake autotools-dev libtool \ 8 pkg-config cmake cmake-data \ 9 zlib1g-dev libev-dev libjemalloc-dev ruby-dev libc-ares-dev bison \ 10 libelf-dev libbrotli-dev 11 12RUN git clone --recursive --depth 1 -b v1.26.0 https://github.com/aws/aws-lc && \ 13 cd aws-lc && \ 14 cmake -B build -DDISABLE_GO=ON && \ 15 make -j$(nproc) -C build && \ 16 cmake --install build && \ 17 cd .. && \ 18 rm -rf aws-lc 19 20RUN git clone --recursive --depth 1 -b v1.3.0 https://github.com/ngtcp2/nghttp3 && \ 21 cd nghttp3 && \ 22 autoreconf -i && \ 23 ./configure --enable-lib-only && \ 24 make -j$(nproc) && \ 25 make install-strip && \ 26 cd .. && \ 27 rm -rf nghttp3 28 29RUN git clone --recursive --depth 1 -b v1.5.0 https://github.com/ngtcp2/ngtcp2 && \ 30 cd ngtcp2 && \ 31 autoreconf -i && \ 32 ./configure --enable-lib-only --with-boringssl \ 33 LIBTOOL_LDFLAGS="-static-libtool-libs" \ 34 BORINGSSL_LIBS="-l:libssl.a -l:libcrypto.a" \ 35 PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig" && \ 36 make -j$(nproc) && \ 37 make install-strip && \ 38 cd .. && \ 39 rm -rf ngtcp2 40 41RUN git clone --depth 1 -b v1.3.0 https://github.com/libbpf/libbpf && \ 42 cd libbpf && \ 43 PREFIX=/usr/local make -C src install && \ 44 cd .. && \ 45 rm -rf libbpf 46 47RUN git clone --recursive --depth 1 -b $NGHTTP2_BRANCH https://github.com/nghttp2/nghttp2 && \ 48 cd nghttp2 && \ 49 autoreconf -i && \ 50 ./configure --disable-examples --disable-hpack-tools \ 51 --with-mruby \ 52 --enable-http3 --with-libbpf \ 53 --with-libbrotlienc --with-libbrotlidec \ 54 CC=clang CXX=clang++ \ 55 LIBTOOL_LDFLAGS="-static-libtool-libs" \ 56 OPENSSL_LIBS="-l:libssl.a -l:libcrypto.a" \ 57 LIBEV_LIBS="-l:libev.a" \ 58 JEMALLOC_LIBS="-l:libjemalloc.a" \ 59 LIBCARES_LIBS="-l:libcares.a" \ 60 ZLIB_LIBS="-l:libz.a" \ 61 LIBBPF_LIBS="-L/usr/local/lib64 -l:libbpf.a -l:libelf.a" \ 62 LIBBROTLIENC_LIBS="-l:libbrotlienc.a -l:libbrotlicommon.a" \ 63 LIBBROTLIDEC_LIBS="-l:libbrotlidec.a -l:libbrotlicommon.a" \ 64 LDFLAGS="-static-libgcc -static-libstdc++" \ 65 PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig" && \ 66 make -j$(nproc) install-strip && \ 67 cd .. && \ 68 rm -rf nghttp2 69 70FROM gcr.io/distroless/base-nossl-debian12 71 72COPY --from=build --link \ 73 /usr/local/share/nghttp2/ \ 74 /usr/local/share/nghttp2/ 75COPY --from=build --link \ 76 /usr/local/bin/h2load \ 77 /usr/local/bin/nghttpx \ 78 /usr/local/bin/nghttp \ 79 /usr/local/bin/nghttpd \ 80 /usr/local/bin/ 81COPY --from=build --link /usr/local/lib/nghttp2/reuseport_kern.o \ 82 /usr/local/lib/nghttp2/ 83