Rewrite docker file

Rewrite docker file so that:

- avoid k8s debian-base
- build h2load as statically as possible
This commit is contained in:
Tatsuhiro Tsujikawa 2021-03-05 23:00:30 +09:00
parent e584d9cd2e
commit 0954932091
1 changed files with 22 additions and 16 deletions

View File

@ -1,10 +1,10 @@
FROM k8s.gcr.io/debian-base-amd64:v2.0.0 FROM debian:10 as build
RUN /usr/local/bin/clean-install git g++ make binutils autoconf automake autotools-dev libtool pkg-config \ RUN apt-get update && \
zlib1g-dev libev-dev libjemalloc-dev ruby-dev libc-ares-dev bison \ apt-get install -y --no-install-recommends \
zlib1g libev4 libjemalloc2 libc-ares2 \ git g++ make binutils autoconf automake autotools-dev libtool \
ca-certificates psmisc \ pkg-config \
python && \ zlib1g-dev libev-dev libjemalloc-dev ruby-dev libc-ares-dev bison && \
git clone --depth 1 -b OpenSSL_1_1_1g-quic-draft-33 https://github.com/tatsuhiro-t/openssl && \ git clone --depth 1 -b OpenSSL_1_1_1g-quic-draft-33 https://github.com/tatsuhiro-t/openssl && \
cd openssl && ./config enable-tls1_3 --openssldir=/etc/ssl && make -j$(nproc) && make install_sw && cd .. && rm -rf openssl && \ cd openssl && ./config enable-tls1_3 --openssldir=/etc/ssl && make -j$(nproc) && make install_sw && cd .. && rm -rf openssl && \
git clone --depth 1 https://github.com/ngtcp2/nghttp3 && \ git clone --depth 1 https://github.com/ngtcp2/nghttp3 && \
@ -18,13 +18,19 @@ RUN /usr/local/bin/clean-install git g++ make binutils autoconf automake autotoo
git clone --depth 1 -b quic https://github.com/nghttp2/nghttp2.git && \ git clone --depth 1 -b quic https://github.com/nghttp2/nghttp2.git && \
cd nghttp2 && \ cd nghttp2 && \
git submodule update --init && autoreconf -i && \ git submodule update --init && autoreconf -i && \
./configure --disable-examples --disable-hpack-tools --disable-python-bindings --with-mruby --with-neverbleed && \ ./configure --disable-examples --disable-hpack-tools \
make -j$(nproc) install-strip && \ --disable-python-bindings --with-mruby --with-neverbleed \
cd .. && \ LIBTOOL_LDFLAGS="-static-libtool-libs" \
rm -rf nghttp2 && \ LIBS="-ldl -pthread" \
strip /usr/local/lib/*.so.*.* /usr/local/lib/engines-*/*.so && \ OPENSSL_LIBS="-l:libssl.a -l:libcrypto.a" \
rm -rf /usr/local/lib/libssl.so /usr/local/lib/libcrypto.so /usr/local/lib/libssl.a /usr/local/lib/libcrypto.a /usr/local/lib/pkgconfig/*ssl.pc /usr/local/include/openssl/* && \ LIBEV_LIBS="-l:libev.a" \
apt-get -y purge git g++ make binutils autoconf automake autotools-dev libtool pkg-config \ JEMALLOC_LIBS="-l:libjemalloc.a" \
zlib1g-dev libev-dev libjemalloc-dev ruby-dev libc-ares-dev bison && \ LIBCARES_LIBS="-l:libcares.a" \
apt-get -y autoremove --purge && \ ZLIB_LIBS="-l:libz.a" && \
rm -rf /var/log/* make -j$(nproc) install-strip
FROM gcr.io/distroless/cc-debian10
COPY --from=build /usr/local/bin/h2load /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/h2load"]