mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2025-08-09 13:19:37 +00:00
Add Docker caching to GitHub actions workflow
Add layer caching to speed up the CI builds. In addition, optimize the Dockerfiles by moving all the dependency installations (which are unlikely to change much) to the initial layers.
This commit is contained in:
22
.github/workflows/build-and-test.yml
vendored
22
.github/workflows/build-and-test.yml
vendored
@@ -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-impersonate
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
context: 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-impersonate
|
||||
uses: docker/build-push-action@v2
|
||||
@@ -41,6 +53,8 @@ jobs:
|
||||
push: true
|
||||
context: 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 container
|
||||
uses: docker/build-push-action@v2
|
||||
@@ -54,3 +68,11 @@ jobs:
|
||||
|
||||
- name: Run the tests
|
||||
run: 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-cache
|
||||
|
@@ -7,6 +7,10 @@ WORKDIR /build
|
||||
RUN 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.0
|
||||
ARG 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
|
||||
|
@@ -8,6 +8,15 @@ WORKDIR /build
|
||||
RUN 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 libnss
|
||||
RUN pip install gyp-next
|
||||
|
||||
@@ -24,10 +33,6 @@ RUN tar xf ${NSS_VERSION}.tar.gz && \
|
||||
ARG NGHTTP2_VERSION=nghttp2-1.46.0
|
||||
ARG 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
|
||||
|
Reference in New Issue
Block a user