name: Docker

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    name: Build ${{ matrix.image }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        image: [ web, reverse-proxy, assets, storage, wvw-crawler ]
    steps:
    - uses: actions/checkout@v3
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v1
    - 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 Docker image
      uses: docker/bake-action@v2.2.0
      with:
        files: ./docker-compose.yml
        targets: ${{ matrix.image }}
        set: |
          *.cache-from=type=local,src=/tmp/.buildx-cache
          *.cache-to=type=type=local,dest=/tmp/.buildx-cache-new
    - name: Move cache
      run: |
        rm -rf /tmp/.buildx-cache
        mv /tmp/.buildx-cache-new /tmp/.buildx-cache

name: Docker

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        target: [ web, reverse-proxy, assets, storage, wvw-crawler ]
    steps:
    - uses: actions/checkout@v3
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v1
    - name: Build the Docker image
      uses: docker/bake-action@v2.2.0
      with:
        files: ./docker-compose.yml
        targets: ${{ matrix.target }}
        set: |
          *.cache-from=type=gha,scope=build-${{ matrix.target }}
          *.cache-to=type=gha,scope=build-${{ matrix.target }},mode=max

Use gha caching instead of local
Use gha caching instead of local