Skip to content

Commit

Permalink
try different caching strategy for docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
MonicaG committed Oct 1, 2024
1 parent a1c5641 commit f306829
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Build Image

env:
REGISTRY: ghcr.io
REPOSITORY_NAME: developer-experience/developer-portal
REPOSITORY_NAME: ${{ github.repository_owner }}/developer-experience/developer-portal

on:
workflow_call:
Expand All @@ -15,21 +15,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Delete unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}
images: ${{ env.REGISTRY }}/${{ env.REPOSITORY_NAME }}
# Always generate latest tag (https://github.com/docker/metadata-action#latest-tag)
flavor: latest=true
# Sha tag is used in udpate_deploy_file job below
Expand All @@ -46,17 +39,18 @@ jobs:
name: Set up QEMU
uses: docker/setup-qemu-action@v3

- # Support for multiplatform build. Using for dev debugging
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build container
uses: docker/build-push-action@v6
env:
CACHE_TAG: buildcache
with:
context: .
file: packages/backend/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=registry,ref=${{ env.REPOSITORY_NAME }}:${{ env.CACHE_TAG }}
cache-to: type=registry,ref=${{ env.REPOSITORY_NAME }}:${{ env.CACHE_TAG }},mode=max

0 comments on commit f306829

Please sign in to comment.