Skip to content

Instantly share code, notes, and snippets.

@xquery
Created February 4, 2020 19:41
Show Gist options
  • Save xquery/e29009ab6c24be1fa7f9f45e78aca42b to your computer and use it in GitHub Desktop.
Save xquery/e29009ab6c24be1fa7f9f45e78aca42b to your computer and use it in GitHub Desktop.
hack dockerfile that builds patched openssl, nghttp3, ngtcp2, curl and sets up aoiquic, runs server on port 81 and we get success with curl -v --http3 https://localhost:81
FROM registry.hub.docker.com/library/alpine
###############################################################
# build curl
###############################################################
# install deps and use latest curl release source
RUN \
apk add \
build-base \
emacs \
clang \
make \
valgrind \
libssh2-dev \
libssh2 \
libssh2-static \
autoconf \
automake \
groff \
curl-dev \
openssl \
libtool \
c-ares c-ares-dev \
zsh \
tcpdump \
htop \
python3 \
python3-dev \
bsd-compat-headers \
libffi-dev \
cmake \
git
RUN wget http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libelf-0.178-r0.apk
RUN apk add libelf-0.178-r0.apk
RUN apk add perf --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
RUN mkdir /src
WORKDIR "/src"
RUN git clone --depth 1 -b OpenSSL_1_1_1d-quic-draft-25 https://github.com/tatsuhiro-t/openssl
WORKDIR "/src/openssl"
RUN ./config enable-tls1_3 --prefix=/opt/openssl-nghttp3
RUN make -j`nproc`
RUN make install_sw
RUN export LD_LIBRARY_PATH=/opt/openssl-nghttp3/lib; /opt/openssl-nghttp3/bin/openssl version
RUN alias openssl-quic='export LD_LIBRARY_PATH=/opt/openssl-nghttp3/lib; /opt/openssl-nghttp3/bin/openssl'
WORKDIR "/src"
RUN git clone https://github.com/ngtcp2/nghttp3
WORKDIR "/src/nghttp3"
RUN cmake -DCMAKE_INSTALL_PREFIX=/opt/nghttp3 -DENABLE_LIB_ONLY=1 .
RUN make && make install
WORKDIR "/src"
RUN git clone https://github.com/ngtcp2/ngtcp2
WORKDIR "/src/ngtcp2"
RUN cmake -E env LDFLAGS="-Wl,-rpath,/opt/openssl-nghttp3/lib" CMAKE_PREFIX_PATH="/opt/openssl-nghttp3:/opt/nghttp3" cmake -DCMAKE_INSTALL_PREFIX=/opt/ngtcp2 .
RUN make & make install
WORKDIR "/src"
RUN git clone https://github.com/curl/curl
WORKDIR "/src/curl"
RUN ./buildconf
RUN export CFLAGS=-g
RUN PKG_CONFIG_PATH="/opt/nghttp3/lib64/pkgconfig:/opt/ngtcp2/lib64/pkgconfig" LDFLAGS="-Wl,-rpath,/opt/openssl-nghttp3/lib" ./configure \
--without-PACKAGE \
--disable-shared \
--without-zlib \
--without-brotli \
--without-winssl --without-schannel \
--without-mesalink --without-nss --without-libpsl \
--without-libmetalink \
--without-librtmp \
--without-winidn --without-libidn2 \
--disable-NTLM --disable-ntlm-wb \
--disable-esni \
--disable-dependency-tracking \
--disable-ftp \
--disable-file \
--disable-ldap \
--disable-ldaps \
--disable-rtsp \
--disable-dict \
--disable-telnet \
--disable-tftp \
--disable-pop3 \
--disable-imap \
--disable-smb \
--disable-smtp \
--disable-gopher \
--disable-tls-srp \
--disable-unix-sockets \
--disable-mime \
--disable-dateparse \
--disable-netrc \
--disable-progress-meter \
--disable-libcurl-option \
--disable-sspi \
--enable-ares \
--enable-http \
--enable-maintainer-mode \
--enable-alt-svc \
--with-ssl=/opt/openssl-nghttp3 \
--with-nghttp3=/opt/nghttp3/lib64 \
--with-ngtcp2=/opt/ngtcp2/lib64
RUN make
RUN make install
WORKDIR "/src"
RUN git clone https://github.com/aiortc/aioquic
WORKDIR "/src/aioquic"
RUN pip3 install -e .
RUN pip3 install aiofiles asgiref httpbin starlette wsproto
WORKDIR "/opt/nghttp3/lib64"
RUN cp -Rf * /usr/local/lib/.
WORKDIR "/src/curl-perf-tests"
ENTRYPOINT ["/bin/zsh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment