Skip to content

I225 6 first steps #3185

I225 6 first steps

I225 6 first steps #3185

Workflow file for this run

name: Docker Build
on:
# allow manually trigger
workflow_dispatch:
push:
branches:
- main
- 'maint-**'
pull_request:
branches:
- main
- 'maint-**'
permissions:
contents: read
env:
DOCKER_IMAGE_TAG: "${{ github.sha }}"
DOCKER_IMAGE_NAME: "mtl"
DOCKER_REGISTRY: "ghcr.io"
DOCKER_REGISTRY_PREFIX: "openvisualcloud/media-transport-library"
DOCKER_REGISTRY_LOGIN: "${{ github.repository == 'openvisualcloud/media-transport-library' }}"
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
ubuntu_build: ${{ steps.filter.outputs.ubuntu_build == 'true' }}
manager_build: ${{ steps.filter.outputs.manager_build == 'true' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: .github/path_filters.yml
ubuntu-docker-build:
needs: changes
runs-on: ubuntu-22.04
timeout-minutes: 120
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu22
dockerfile: docker/ubuntu22.dockerfile
image_suffix: ""
- name: ubuntu24
dockerfile: docker/ubuntu24.dockerfile
image_suffix: "-ubuntu24"
- name: rocky9
dockerfile: docker/rocky9.dockerfile
image_suffix: "-rocky9"
steps:
- name: Harden Runner
if: ${{ needs.changes.outputs.ubuntu_build == 'true' }}
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- name: Checkout repository
if: ${{ needs.changes.outputs.ubuntu_build == 'true' }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Docker Buildx
if: ${{ needs.changes.outputs.ubuntu_build == 'true' }}
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
with:
buildkitd-flags: "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
platforms: "linux/amd64/v4"
driver-opts: memory=14Gib,memory-swap=25Gib,env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000,env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000
- name: Login to Docker Container Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
if: ${{ needs.changes.outputs.ubuntu_build == 'true' && env.DOCKER_REGISTRY_LOGIN == 'true' }}
id: dockerLoginStep
continue-on-error: true
with:
registry: "${{ env.DOCKER_REGISTRY }}"
username: "${{ github.repository_owner }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: Build image (${{ matrix.name }})
if: ${{ needs.changes.outputs.ubuntu_build == 'true' }}
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
push: "${{ env.DOCKER_REGISTRY_LOGIN == 'true' && steps.dockerLoginStep.outcome == 'SUCCESS' && github.ref == 'refs/heads/main' }}"
context: "${{ github.workspace }}"
file: "${{ github.workspace }}/${{ matrix.dockerfile }}"
tags: "${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REGISTRY_PREFIX }}/${{ env.DOCKER_IMAGE_NAME }}${{ matrix.image_suffix }}:${{ env.DOCKER_IMAGE_TAG }}"
cache-from: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}-${{ matrix.name }}"
cache-to: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}-${{ matrix.name }},mode=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'max' || 'min' }}"
manager-docker-build:
needs: changes
runs-on: ubuntu-22.04
timeout-minutes: 120
permissions:
contents: read
packages: write
env:
DOCKER_IMAGE_NAME: mtl-manager
steps:
- name: Harden Runner
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
with:
buildkitd-flags: "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host"
platforms: "linux/amd64/v4"
driver-opts: memory=14Gib,memory-swap=25Gib,env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000,env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000
- name: Cache version from version file
id: version
working-directory: ${{ github.workspace }}
run: echo "VERSION=$(cat VERSION)">> "$GITHUB_OUTPUT"
- name: Login to Docker Container Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
if: ${{ env.DOCKER_REGISTRY_LOGIN == 'true' }}
id: dockerLoginStep
continue-on-error: true
with:
registry: "${{ env.DOCKER_REGISTRY }}"
username: "${{ github.repository_owner }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: Build manager image
if: ${{ needs.changes.outputs.ubuntu_build == 'true' }}
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
push: "${{ env.DOCKER_REGISTRY_LOGIN == 'true' && steps.dockerLoginStep.outcome == 'SUCCESS' && github.ref == 'refs/heads/main' }}"
context: "${{ github.workspace }}/manager"
file: "${{ github.workspace }}/manager/Dockerfile"
tags: "${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REGISTRY_PREFIX }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}"
cache-from: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}"
cache-to: "type=gha,scope=${{ env.DOCKER_IMAGE_NAME }},mode=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'max' || 'min' }}"
build-args: VERSION=${{ steps.version.outputs.VERSION }}