curl-impersonate: A special build of curl that can impersonate Chrome & Firefox
Add Docker caching to GitHub actions workflow
lwthiker0771c55799ab
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.ymlindex 8b13b0a..6be8c82 100644--- a/.github/workflows/build-and-test.yml+++ b/.github/workflows/build-and-test.yml@@ -28,12 +28,24 @@ jobs:with:driver-opts: network=host+ # Set up Docker caching. See+ # https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md+ - name: Cache Docker layers+ uses: actions/cache@v2+ with:+ path: /tmp/.buildx-cache+ key: ${{ runner.os }}-buildx-${{ github.sha }}+ restore-keys: |+ ${{ runner.os }}-buildx-+- name: Build the Chrome version of curl-impersonateuses: docker/build-push-action@v2with:push: truecontext: chrome/tags: localhost:5000/curl-impersonate/chrome+ cache-from: type=local,src=/tmp/.buildx-cache+ cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max- name: Build the Firefox version of curl-impersonateuses: docker/build-push-action@v2@@ -41,6 +53,8 @@ jobs:push: truecontext: firefox/tags: localhost:5000/curl-impersonate/ff+ cache-from: type=local,src=/tmp/.buildx-cache+ cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max- name: Build the tests containeruses: docker/build-push-action@v2@@ -54,3 +68,11 @@ jobs:- name: Run the testsrun: docker run --rm curl-impersonate-tests --log-cli-level DEBUG++ # Temp fix+ # https://github.com/docker/build-push-action/issues/252+ # https://github.com/moby/buildkit/issues/1896+ - name: Move cache+ run: |+ rm -rf /tmp/.buildx-cache+ mv /tmp/.buildx-cache-new /tmp/.buildx-cachediff --git a/chrome/Dockerfile b/chrome/Dockerfileindex 8f36531..9f0fe7f 100644--- a/chrome/Dockerfile+++ b/chrome/Dockerfile@@ -7,6 +7,10 @@ WORKDIR /buildRUN apt-get update && \apt-get install -y git g++ cmake golang-go ninja-build curl unzip zlib1g-dev libbrotli-dev+# The following are needed because we are going to change some autoconf scripts,+# both for libnghttp2 and curl.+RUN apt-get install -y autoconf automake autotools-dev pkg-config libtool+# BoringSSL doesn't have versions. Choose a commit that is used in a stable# Chromium version.ARG BORING_SSL_COMMIT=3a667d10e94186fd503966f5638e134fe9fb4080@@ -33,10 +37,6 @@ RUN mkdir boringssl/build/lib && \ARG NGHTTP2_VERSION=nghttp2-1.46.0ARG NGHTTP2_URL=https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/nghttp2-1.46.0.tar.bz2-# The following are needed because we are going to change some autoconf scripts,-# both for libnghttp2 and curl.-RUN apt-get install -y autoconf automake autotools-dev pkg-config libtool-# Download nghttp2 for HTTP/2.0 support.RUN curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL}RUN tar xf ${NGHTTP2_VERSION}.tar.bz2diff --git a/firefox/Dockerfile b/firefox/Dockerfileindex 1c5f9ca..82fcf75 100644--- a/firefox/Dockerfile+++ b/firefox/Dockerfile@@ -8,6 +8,15 @@ WORKDIR /buildRUN apt-get update && \apt-get install -y mercurial git ninja-build python3-pip curl zlib1g-dev libbrotli-dev+# The following are needed because we are going to change some autoconf scripts,+# both for libnghttp2 and curl.+RUN apt-get install -y autoconf automake autotools-dev pkg-config libtool++# curl tries to load the CA certificates for libnss.+# It loads them from /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so,+# which is supplied by libnss3 on Debian/Ubuntu+RUN apt-get install -y libnss3+# Also needed for building libnssRUN pip install gyp-next@@ -24,10 +33,6 @@ RUN tar xf ${NSS_VERSION}.tar.gz && \ARG NGHTTP2_VERSION=nghttp2-1.46.0ARG NGHTTP2_URL=https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/nghttp2-1.46.0.tar.bz2-# The following are needed because we are going to change some autoconf scripts,-# both for libnghttp2 and curl.-RUN apt-get install -y autoconf automake autotools-dev pkg-config libtool-# Download nghttp2 for HTTP/2.0 support.RUN curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL}RUN tar xf ${NGHTTP2_VERSION}.tar.bz2@@ -59,11 +64,6 @@ RUN cd ${CURL_VERSION} && \./configure --with-nss=/build/${NSS_VERSION}/dist/Release --enable-static --disable-shared CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" --with-nghttp2=/usr/local USE_CURL_SSLKEYLOGFILE=true && \make-# curl tries to load the CA certificates for libnss.-# It loads them from /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so,-# which is supplied by libnss3 on Debian/Ubuntu-RUN apt-get install -y libnss3-RUN mkdir out && \cp ${CURL_VERSION}/src/curl out/curl-impersonate && \strip out/curl-impersonate