Add mode=max
when exporting cache
#21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Autoware builder container images | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '34 15 * * 0' # 15:34 UTC every Sunday | |
push: | |
paths: | |
- Dockerfile | |
- autoware.repos.yml | |
- .github/workflows/builder-build.yml # Self-trigger | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: bounverif/autoware | |
AUTOWARE_VERSION: latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
autoware-builder-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@v10 | |
with: | |
root-reserve-mb: 2048 # Reserve disk space for repository | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
remove-docker-images: 'true' | |
build-mount-path: '/var/lib/docker' # The remaining space only for Docker | |
- name: Restart docker | |
run: sudo service docker restart | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set current date as the version | |
run: echo "AUTOWARE_VERSION=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- name: Build builder image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
target: autoware-builder | |
build-args: | | |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}" | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder | |
load: true | |
no-cache: true | |
cache-to: type=inline,mode=max | |
- name: Build builder w/cache image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
target: autoware-builder-with-cache | |
build-args: | | |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}" | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache | |
load: true | |
cache-from: | | |
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder | |
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache | |
cache-to: type=inline,mode=max | |
- name: Push builder image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
target: autoware-builder | |
build-args: | | |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}" | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-builder | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder | |
push: true | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder | |
cache-to: type=inline,mode=max | |
- name: Push builder-with-cache image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
target: autoware-builder-with-cache | |
build-args: | | |
"AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}" | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-builder-with-cache | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache | |
push: true | |
cache-from: | | |
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder | |
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.AUTOWARE_VERSION }}-builder-with-cache | |
cache-to: type=inline,mode=max |