Skip to content

Mon 22230 create a dedicated docker image of centreon collect (#923) #431

Mon 22230 create a dedicated docker image of centreon collect (#923)

Mon 22230 create a dedicated docker image of centreon collect (#923) #431

name: docker-builder
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
paths:
- '.github/docker/**'
pull_request:
paths:
- '.github/docker/**'
jobs:
get-version:
uses: ./.github/workflows/get-version.yml
create-and-push-docker:
needs: [get-version]
strategy:
fail-fast: false
matrix:
include:
- runner: collect
dockerfile: centreon-collect-alma8
image: centreon-collect-alma8
tag: ${{ needs.get-version.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-alma9
image: centreon-collect-alma9
tag: ${{ needs.get-version.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-alma9-test
image: centreon-collect-alma9-test
tag: ${{ needs.get-version.outputs.test_img_version }}
- runner: collect
dockerfile: centreon-collect-mysql-alma9
image: centreon-collect-mysql-alma9
tag: ${{ needs.get-version.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-mysql-alma9-test
image: centreon-collect-mysql-alma9-test
tag: ${{ needs.get-version.outputs.test_img_version }}
- runner: collect
dockerfile: centreon-collect-debian-bullseye
image: centreon-collect-debian-bullseye
tag: ${{ needs.get-version.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-debian-bullseye-test
image: centreon-collect-debian-bullseye-test
tag: ${{ needs.get-version.outputs.test_img_version }}
- runner: collect-arm64
dockerfile: centreon-collect-debian-bullseye
image: centreon-collect-debian-bullseye-arm64
tag: ${{ needs.get-version.outputs.img_version }}
- runner: collect-arm64
dockerfile: centreon-collect-debian-bullseye-test
image: centreon-collect-debian-bullseye-arm64-test
tag: ${{ needs.get-version.outputs.test_img_version }}
runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.runner)) }}
name: build container ${{ matrix.image }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
- name: Login to Proxy Registry
uses: docker/login-action@v2
with:
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
- uses: docker/setup-buildx-action@v2
- name: Build image ${{ matrix.image }}:${{ matrix.tag }}
uses: docker/build-push-action@v3
with:
file: .github/docker/Dockerfile.${{ matrix.dockerfile }}
context: .
build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}"
platforms: ${{ contains(matrix.runner, 'arm') && 'linux/arm64' || 'linux/amd64' }}
pull: true
push: true
tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:${{ matrix.tag }}