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 --shallow-submodules --depth 1 -b v1.36.1 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 --shallow-submodules --depth 1 -b v1.6.0 https://github.com/ngtcp2/nghttp3 && \ 21 cd nghttp3 && \ 22 autoreconf -i && \ 23 ./configure --disable-dependency-tracking --enable-lib-only && \ 24 make -j$(nproc) && \ 25 make install-strip && \ 26 cd .. && \ 27 rm -rf nghttp3 28 29RUN git clone --recursive --shallow-submodules --depth 1 -b v1.8.1 https://github.com/ngtcp2/ngtcp2 && \ 30 cd ngtcp2 && \ 31 autoreconf -i && \ 32 ./configure --disable-dependency-tracking --enable-lib-only \ 33 --with-boringssl \ 34 LIBTOOL_LDFLAGS="-static-libtool-libs" \ 35 BORINGSSL_LIBS="-l:libssl.a -l:libcrypto.a" \ 36 PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig" && \ 37 make -j$(nproc) && \ 38 make install-strip && \ 39 cd .. && \ 40 rm -rf ngtcp2 41 42RUN git clone --depth 1 -b v1.4.6 https://github.com/libbpf/libbpf && \ 43 cd libbpf && \ 44 PREFIX=/usr/local make -C src install && \ 45 cd .. && \ 46 rm -rf libbpf 47 48RUN git clone --recursive --shallow-submodules --depth 1 -b $NGHTTP2_BRANCH https://github.com/nghttp2/nghttp2 && \ 49 cd nghttp2 && \ 50 autoreconf -i && \ 51 ./configure --disable-dependency-tracking --disable-examples \ 52 --disable-hpack-tools \ 53 --with-mruby \ 54 --enable-http3 --with-libbpf \ 55 --with-libbrotlienc --with-libbrotlidec \ 56 CC=clang CXX=clang++ \ 57 LIBTOOL_LDFLAGS="-static-libtool-libs" \ 58 OPENSSL_LIBS="-l:libssl.a -l:libcrypto.a" \ 59 LIBEV_LIBS="-l:libev.a" \ 60 JEMALLOC_LIBS="-l:libjemalloc.a" \ 61 LIBCARES_LIBS="-l:libcares.a" \ 62 ZLIB_LIBS="-l:libz.a" \ 63 LIBBPF_LIBS="-L/usr/local/lib64 -l:libbpf.a -l:libelf.a" \ 64 LIBBROTLIENC_LIBS="-l:libbrotlienc.a -l:libbrotlicommon.a" \ 65 LIBBROTLIDEC_LIBS="-l:libbrotlidec.a -l:libbrotlicommon.a" \ 66 LDFLAGS="-static-libgcc -static-libstdc++" \ 67 PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig" && \ 68 make -j$(nproc) install-strip && \ 69 cd .. && \ 70 rm -rf nghttp2 71 72FROM gcr.io/distroless/base-nossl-debian12 73 74COPY --from=build --link \ 75 /usr/local/share/nghttp2/ \ 76 /usr/local/share/nghttp2/ 77COPY --from=build --link \ 78 /usr/local/bin/h2load \ 79 /usr/local/bin/nghttpx \ 80 /usr/local/bin/nghttp \ 81 /usr/local/bin/nghttpd \ 82 /usr/local/bin/ 83COPY --from=build --link /usr/local/lib/nghttp2/reuseport_kern.o \ 84 /usr/local/lib/nghttp2/ 85