forked from macbre/curl-http3
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
92 lines (76 loc) · 2.57 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# https://github.com/curl/curl/releases
ARG CURL_VERSION=curl-7_84_0
# https://github.com/cloudflare/quiche/releases
ARG QUICHE_VERSION=0.14.0
FROM rust:alpine AS base
ARG CURL_VERSION
ARG QUICHE_VERSION
WORKDIR /opt
# install dependency
RUN apk add --no-cache \
autoconf \
automake \
brotli-dev \
build-base \
cmake \
git \
libtool \
nghttp2-dev \
pkgconfig \
wget \
libpsl-dev \
zlib-dev
# set up our home directory
RUN mkdir -p /root
ENV HOME /root
# set up Rust
#RUN wget https://sh.rustup.rs -O - | sh -s -- -y
ENV PATH "${PATH}:$HOME/.cargo/bin"
RUN cargo --version; rustc --version
# @see https://curl.se/docs/http3.html#quiche-version
RUN \
echo "Building quiche ${QUICHE_VERSION} ..." && \
git clone -b ${QUICHE_VERSION} --depth 1 --single-branch https://github.com/cloudflare/quiche.git && \
cd quiche && \
git submodule init && \
git submodule update && \
cargo build --package quiche --release --features ffi,pkg-config-meta,qlog
RUN \
mkdir /opt/quiche/quiche/deps/boringssl/src/lib/ && \
ln -vnf $(find ./quiche/target/release/build/ -name libcrypto.a -o -name libssl.a) /opt/quiche/quiche/deps/boringssl/src/lib/
RUN \
cd /opt && \
echo "Building ${CURL_VERSION} ..." && \
git clone -b ${CURL_VERSION} --depth 1 --single-branch https://github.com/curl/curl && \
cd curl && \
autoreconf -fi && \
./configure LDFLAGS="-Wl,-rpath,/opt/quiche/target/release" \
--with-brotli \
--with-nghttp2 \
--with-openssl=/opt/quiche/quiche/deps/boringssl/src \
--with-quiche=/opt/quiche/target/release \
--with-zlib && \
make && \
make install
# so that we know what to copy over from the "base" stage
RUN ldd $(which curl)
# make our resulting image way smaller
# from 2.85GB to 44.9MB
FROM alpine:latest
ARG CURL_VERSION
ARG QUICHE_VERSION
ENV CURL_VERSION $CURL_VERSION
ENV QUICHE_VERSION $QUICHE_VERSION
COPY --from=base /usr/local/bin/curl /usr/local/bin/curl
COPY --from=base /usr/local/lib/libcurl.so.4 /usr/local/lib/libcurl.so.4
COPY --from=base /usr/lib/libidn2.so.0 /usr/lib/libidn2.so.0
COPY --from=base /usr/lib/libunistring.so.5 /usr/lib/libunistring.so.5
COPY --from=base /usr/lib/libpsl.so.5 /usr/lib/libpsl.so.5
COPY --from=base /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1
COPY --from=base /usr/lib/libnghttp2.so.14 /usr/lib/libnghttp2.so.14
COPY --from=base /usr/lib/libbrotlidec.so.1 /usr/lib/libbrotlidec.so.1
COPY --from=base /lib/libz.so.1 /lib/libz.so.1
COPY --from=base /usr/lib/libbrotlicommon.so.1 /usr/lib/libbrotlicommon.so.1
# we do not need root anymore
USER nobody
RUN env | sort; which curl; curl --version