name: Build docker base image concurrency: group: base-${{ github.ref }} cancel-in-progress: true ## Update the base image every day on: workflow_dispatch: schedule: ## In UTC - cron: '0 0 * * *' ## Build base images to be used by other github workflows jobs: base-image: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 with: path: /tmp/.docker-buildx-cache key: docker-buildx - uses: docker/setup-buildx-action@v1 - uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ github.token }} - uses: docker/metadata-action@v3 id: meta with: images: ghcr.io/${{ github.repository }}/base flavor: | latest=true tags: | type=ref,event=branch type=ref,event=tag type=semver,pattern={{version}} - name: Build base image uses: docker/build-push-action@v2 with: push: true pull: true cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max platforms: linux/amd64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} file: .github/dockerfile/Dockerfile context: . - name: Update cache run: | rm -rf /tmp/.docker-buildx-cache mv /tmp/.docker-buildx-cache-new /tmp/.docker-buildx-cache