ci: improve containers build caching
This commit is contained in:
parent
1c3c15f3af
commit
369b85018a
|
@ -4,8 +4,6 @@ description: Build and push a container
|
||||||
inputs:
|
inputs:
|
||||||
target:
|
target:
|
||||||
required: true
|
required: true
|
||||||
images:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
|
@ -13,12 +11,15 @@ runs:
|
||||||
- uses: docker/metadata-action@v4
|
- uses: docker/metadata-action@v4
|
||||||
id: meta
|
id: meta
|
||||||
with:
|
with:
|
||||||
images: ${{ inputs.images }}
|
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ inputs.target }}
|
||||||
|
|
||||||
- uses: docker/build-push-action@v3
|
- uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ startsWith(github.ref, 'refs/tags') }}
|
pull: true
|
||||||
|
push: ${{ github.event_name == 'push' }}
|
||||||
target: ${{ inputs.target }}
|
target: ${{ inputs.target }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha,scope=${{ inputs.target }}
|
||||||
|
cache-to: type=gha,scope=${{ inputs.target }},mode=max
|
||||||
|
|
|
@ -17,43 +17,68 @@ jobs:
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
NAMESPACE: ${{ github.repository_owner }}
|
NAMESPACE: ${{ github.repository_owner }}
|
||||||
|
CACHE_REF: ghcr.io/${{ github.repository_owner }}/libretime-cache
|
||||||
|
|
||||||
if: ${{ github.repository_owner == 'libretime' }}
|
if: ${{ github.repository_owner == 'libretime' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- uses: docker/login-action@v2
|
- uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build libretime-analyzer
|
- name: Build python-builder
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
pull: true
|
||||||
|
target: python-builder
|
||||||
|
cache-from: type=gha,scope=python-builder
|
||||||
|
cache-to: type=gha,scope=python-builder,mode=max
|
||||||
|
|
||||||
|
- name: Build python-base
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
pull: true
|
||||||
|
target: python-base
|
||||||
|
cache-from: type=gha,scope=python-base
|
||||||
|
cache-to: type=gha,scope=python-base,mode=max
|
||||||
|
|
||||||
|
- name: Build python-base-ffmpeg
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
pull: true
|
||||||
|
target: python-base-ffmpeg
|
||||||
|
cache-from: type=gha,scope=python-base-ffmpeg
|
||||||
|
cache-to: type=gha,scope=python-base-ffmpeg,mode=max
|
||||||
|
|
||||||
|
- name: Build analyzer
|
||||||
uses: ./.github/workflows/actions/build-container
|
uses: ./.github/workflows/actions/build-container
|
||||||
with:
|
with:
|
||||||
target: libretime-analyzer
|
target: libretime-analyzer
|
||||||
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-analyzer
|
|
||||||
|
|
||||||
- name: Build libretime-api
|
- name: Build api
|
||||||
uses: ./.github/workflows/actions/build-container
|
uses: ./.github/workflows/actions/build-container
|
||||||
with:
|
with:
|
||||||
target: libretime-api
|
target: libretime-api
|
||||||
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-api
|
|
||||||
|
|
||||||
- name: Build libretime-playout
|
- name: Build playout
|
||||||
uses: ./.github/workflows/actions/build-container
|
uses: ./.github/workflows/actions/build-container
|
||||||
with:
|
with:
|
||||||
target: libretime-playout
|
target: libretime-playout
|
||||||
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-playout
|
|
||||||
|
|
||||||
- name: Build libretime-worker
|
- name: Build worker
|
||||||
uses: ./.github/workflows/actions/build-container
|
uses: ./.github/workflows/actions/build-container
|
||||||
with:
|
with:
|
||||||
target: libretime-worker
|
target: libretime-worker
|
||||||
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-worker
|
|
||||||
|
|
||||||
- name: Build libretime-legacy
|
- name: Build legacy
|
||||||
uses: ./.github/workflows/actions/build-container
|
uses: ./.github/workflows/actions/build-container
|
||||||
with:
|
with:
|
||||||
target: libretime-legacy
|
target: libretime-legacy
|
||||||
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-legacy
|
|
||||||
|
|
Loading…
Reference in New Issue