Skip to content

Commit

Permalink
Add caching
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Jan 12, 2024
1 parent 68325ba commit 7ee4d8b
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/check-dev-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ concurrency:
cancel-in-progress: true

jobs:
changes:
name: Check if devcontainer has changed
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
devcontainer: ${{ steps.filter.outputs.devcontainer }}
steps:
- uses: actions/checkout@v4.1.1
container_base:
runs-on: ubuntu-latest
steps:
Expand All @@ -33,6 +24,15 @@ jobs:
devcontainer_base:
- '.devcontainer/Dockerfile.base'
- .github/workflows/check-dev-containers.yml
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
- name: Cache Docker layers
uses: actions/cache@v3
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Build DevContainer Base
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
uses: docker/build-push-action@v5.1.0
Expand All @@ -51,6 +51,15 @@ jobs:
devcontainer:
- '.devcontainer/Dockerfile'
- .github/workflows/check-dev-containers.yml
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: ${{ steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
- name: Cache Docker layers
uses: actions/cache@v3
if: ${{ steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Build DevContainer
if: ${{ steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
uses: docker/build-push-action@v5.1.0
Expand Down Expand Up @@ -79,17 +88,20 @@ jobs:
- .github/workflows/check-dev-containers.yml
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
with:
driver-opts: network=host
- name: Cache Docker layers
uses: actions/cache@v3
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Build DevContainer Base
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
uses: docker/build-push-action@v5.1.0
with:
context: '.devcontainer/'
Expand All @@ -98,7 +110,9 @@ jobs:
tags: localhost:5000/eclipse-ankaios/devcontainer-base:dev
- name: Change image reference
if: ${{ steps.filter.outputs.devcontainer_base == 'true' }}
run: sed -i "s#ghcr.io/eclipse-ankaios/devcontainer-base:.*#localhost:5000/eclipse-ankaios/devcontainer-base:dev#"
run: |
sed -i "s#ghcr.io/eclipse-ankaios/devcontainer-base:.*#localhost:5000/eclipse-ankaios/devcontainer-base:dev#" .devcontainer/Dockerfile
cat .devcontainer/Dockerfile
- name: Build DevContainer
if: ${{ steps.filter.outputs.devcontainer_base == 'true' || steps.filter.outputs.devcontainer == 'true' || github.ref_name == 'main' || github.ref_type == 'tag'}}
uses: docker/build-push-action@v5.1.0
Expand Down

0 comments on commit 7ee4d8b

Please sign in to comment.