-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.ja3
80 lines (76 loc) · 3.8 KB
/
Dockerfile.ja3
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
# 构建 curl-impersonate
FROM a76yyyy/ddddocr:latest
# 维护者信息
LABEL maintainer "a76yyyy <[email protected]>"
LABEL org.opencontainers.image.source=https://github.com/qiandao-today/pycurl-docker
ARG CURL_VERSION=8.1.1
ENV PYCURL_SSL_LIBRARY=openssl
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
RUN apk update && \
apk add --update --no-cache bash git tzdata ca-certificates\
python3 py3-six && \
apk add --update --no-cache --virtual .build_deps nano openssh-client \
patch cargo cmake make perl autoconf g++ automake linux-headers libtool \
util-linux file libidn2-dev libgsasl-dev krb5-dev zstd-dev nghttp2-dev zlib-dev \
python3-dev c-ares-dev go brotli-dev py3-pip py3-setuptools py3-wheel libpsl-dev && \
wget https://curl.haxx.se/download/curl-$CURL_VERSION.tar.bz2 && \
tar xjf curl-$CURL_VERSION.tar.bz2 && \
rm curl-$CURL_VERSION.tar.bz2 && \
git clone --recursive https://github.com/cloudflare/quiche && \
cd /quiche && \
git submodule update --init && \
cd /quiche/quiche/deps/boringssl && \
mkdir build && \
cd build && \
[[ $(getconf LONG_BIT) = "32" && -z $(file /bin/busybox | grep -i "arm") ]] && configtmp="cmake -DCMAKE_OSX_ARCHITECTURES=i386 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-msse2 -DCMAKE_C_FLAGS=-m32 -DCMAKE_C_FLAGS=-msse2 -DCMAKE_ASM_FLAGS=-m32 -DCMAKE_ASM_FLAGS=-msse2" || configtmp="cmake " && \
$configtmp -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=on .. && \
make -j`nproc` && \
cd /quiche/quiche && \
mkdir deps/boringssl/src/lib && \
ln -vnf $(find -name libcrypto.a -o -name libssl.a) deps/boringssl/src/lib/ && \
# mkdir -p ~/.cargo && \
# echo -e "[source.crates-io]\nreplace-with = 'ustc'\n[source.ustc]\nregistry = 'https:\/\/mirrors.ustc.edu.cn\/crates.io-index'" > ~/.cargo/config && \
git config http.postBuffer 524288000 && \
git config http.sslVerify "false" && \
cargo build --verbose --package quiche --release --features ffi,pkg-config-meta,qlog && \
# mv ../target/release/libquiche.so /usr/lib/libquiche.so && \
cd /curl-$CURL_VERSION && \
wget https://cdn.jsdelivr.net/gh/lwthiker/curl-impersonate@main/chrome/patches/curl-impersonate.patch && \
wget https://cdn.jsdelivr.net/gh/curl/curl@master/lib/easy_lock.h -O lib/easy_lock.h && \
# wget https://cdn.jsdelivr.net/gh/curl/curl@master/lib/vquic/quiche.c -O lib/vquic/quiche.c && \
# wget https://cdn.jsdelivr.net/gh/curl/curl@master/lib/vquic/quiche.h -O lib/vquic/quiche.h && \
for p in $(ls curl-*.patch); do patch -p1 < $p; done && \
autoreconf -fi && \
LDFLAGS="-Wl,-rpath,/usr/lib,-rpath,$PWD/../quiche/target/release" ./configure \
--with-openssl=$PWD/../quiche/quiche/deps/boringssl/src \
# --with-quiche=$PWD/../quiche/target/release \
--with-nghttp2=/usr \
--without-ngtcp2 \
--with-brotli \
--prefix=/usr \
--enable-ipv6 \
--enable-unix-sockets \
--with-libidn2 \
--disable-static \
--disable-ldap \
--with-pic \
--with-gssapi \
--enable-ares \
USE_CURL_SSLKEYLOGFILE=true && \
make -j$(($(grep -c ^processor /proc/cpuinfo) - 0)) && \
make install && \
cd / && \
ln -fs /usr/bin/curl-impersonate-chrome /usr/bin/curl && \
ln -fs /usr/bin/curl-impersonate-chrome-config /usr/bin/curl-config && \
git clone https://github.com/a76yyyy/pycurl-ja3.git && \
cd pycurl-ja3 && \
python3 setup.py install --openssl-dir=$PWD/../quiche/quiche/deps/boringssl/src && \
cd / && \
apk del .build_deps && \
apk add --update --no-cache libidn2 libgsasl zstd-libs zlib c-ares libpsl && \
rm -rf /curl-$CURL_VERSION && \
rm -rf /quiche && \
rm -rf ~/.cargo && \
rm -rf /pycurl-ja3 && \
rm -rf /var/cache/apk/* && \
rm -rf /usr/share/man/*