Skip to content

Commit

Permalink
added HTTP/3 support to cURL
Browse files Browse the repository at this point in the history
  • Loading branch information
suvl committed May 13, 2024
1 parent 620e19c commit 39c3143
Showing 1 changed file with 85 additions and 32 deletions.
117 changes: 85 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,49 @@
FROM debian:12 AS builder

# this builder part is the work of Yury Muski, from https://github.com/yurymuski/curl-http3
LABEL maintainer="Yury Muski <[email protected]>"

WORKDIR /opt

ARG CURL_VERSION=curl-8_2_1
ARG QUICHE_VERSION=0.18.0

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git autoconf libtool cmake golang-go curl libnghttp2-dev zlib1g-dev;

# https://github.com/curl/curl/blob/master/docs/HTTP3.md#quiche-version

# install rust & cargo
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y -q;

RUN git clone --recursive https://github.com/cloudflare/quiche

# build quiche
RUN export PATH="$HOME/.cargo/bin:$PATH" && \
cd quiche && \
git checkout $QUICHE_VERSION && \
cargo build --package quiche --release --features ffi,pkg-config-meta,qlog && \
mkdir quiche/deps/boringssl/src/lib && \
ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) quiche/deps/boringssl/src/lib/


# add curl
RUN git clone https://github.com/curl/curl
RUN cd curl && \
git checkout $CURL_VERSION && \
autoreconf -fi && \
./configure LDFLAGS="-Wl,-rpath,/opt/quiche/target/release" --with-openssl=/opt/quiche/quiche/deps/boringssl/src --with-quiche=/opt/quiche/target/release --with-nghttp2 --with-zlib && \
make && \
make DESTDIR="/debian/" install


# match doks-debug version with DOKS worker node image version for kernel
# tooling compatibility reasons
FROM debian:stable-slim

LABEL org.opencontainers.image.source=https://github.com/nosportugal/debug-pod
LABEL org.opencontainers.image.description="A debian image with some debugging tools installed."
LABEL org.opencontainers.image.authors="NOS Portugal"

WORKDIR /root

Expand All @@ -17,38 +57,48 @@ RUN echo 'path-include=/usr/share/doc/*/changelog.Debian.*' > /etc/dpkg/dpkg.cfg
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/backports.list

RUN apt-get update && \
apt-get install -y apt-transport-https \
ca-certificates \
software-properties-common \
httping \
man \
man-db \
vim \
screen \
curl \
gnupg \
atop \
htop \
dstat \
jq \
dnsutils \
tcpdump \
traceroute \
iputils-ping \
net-tools \
ncat \
iproute2 \
strace \
telnet \
openssl \
psmisc \
dsniff \
mtr-tiny \
conntrack \
bpftool \
nmap \
redis-tools \
kafkacat
apt-get install -y \
apt-transport-https \
ca-certificates \
software-properties-common \
httping \
man \
man-db \
vim \
screen \
gnupg \
atop \
htop \
dstat \
jq \
dnsutils \
tcpdump \
traceroute \
iputils-ping \
net-tools \
ncat \
iproute2 \
strace \
telnet \
openssl \
psmisc \
dsniff \
mtr-tiny \
conntrack \
bpftool \
nmap \
redis-tools \
kafkacat \
nghttp2 \
zlib1g && \
rm -rf /var/lib/apt/lists/*

COPY --from=builder /debian/usr/local/ /usr/local/
COPY --from=builder /opt/quiche/target/release /opt/quiche/target/release

# Resolve any issues of C-level lib
# location caches ("shared library cache")
RUN ldconfig

RUN install -m 0755 -d /etc/apt/keyrings && \
. /etc/os-release && \
Expand All @@ -74,4 +124,7 @@ RUN curl -Lv -o /usr/bin/hey https://hey-release.s3.us-east-2.amazonaws.com/hey_
RUN curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash && \
apt-get install -y speedtest

# add httpstat script
RUN curl -s https://raw.githubusercontent.com/b4b4r07/httpstat/master/httpstat.sh >httpstat.sh && chmod +x httpstat.sh

ENTRYPOINT [ "/bin/bash" ]

0 comments on commit 39c3143

Please sign in to comment.