Skip to content

Commit

Permalink
Set individual caches to speed up CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
andersfischernielsen committed Feb 17, 2021
1 parent fef2dca commit a6ebe92
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/dockerimage.yml
Expand Up @@ -3,7 +3,7 @@ name: Docker Image CI
on: [push]

jobs:
build_with_cache:
build_test_project:
runs-on: ubuntu-latest
services:
registry:
Expand All @@ -16,10 +16,24 @@ jobs:
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Cache Docker layers
- name: Set colonists-shared cache
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
path: /tmp/.buildx-cache-shared
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set colonists-server cache
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache-server
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set colonists-client cache
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache-client
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
Expand All @@ -28,16 +42,18 @@ jobs:
with:
push: true
tags: localhost:5000/colonists/colonists-shared
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=local,src=/tmp/.buildx-cache-shared
cache-to: type=local,dest=/tmp/.buildx-cache-shared
context: ./colonists-shared
- name: Run shared tests
run: docker run --rm localhost:5000/colonists/colonists-shared
- name: Build server
uses: docker/build-push-action@v2
with:
push: false
tags: colonists/colonists-server
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=local,src=/tmp/.buildx-cache-server
cache-to: type=local,dest=/tmp/.buildx-cache-server
context: ./colonists-server
build-args: |
"LOCAL_REGISTRY=localhost:5000/"
Expand All @@ -46,11 +62,9 @@ jobs:
with:
push: false
tags: colonists/colonists-client
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
cache-from: type=local,src=/tmp/.buildx-cache-client
cache-to: type=local,dest=/tmp/.buildx-cache-client
context: ./colonists-client
build-args: |
"LOCAL_REGISTRY=localhost:5000/"
- name: Run shared tests
run: docker run --rm localhost:5000/colonists/colonists-shared

0 comments on commit a6ebe92

Please sign in to comment.