mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2026-09-07 09:21:51 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user