1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
|
name: Docker
on:
workflow_call:
inputs:
sha:
required: true
type: string
branch:
required: true
type: string
is_fork:
required: true
type: string
publish_docker_image:
required: true
type: string
docker_release:
required: true
type: string
build_platform:
required: true
type: string
build_include:
required: true
type: string
ocaml_version:
required: true
type: string
ocaml_docker_release_version:
required: true
type: string
secrets:
DOCKERHUB_USER:
required: true
DOCKERHUB_PASSWORD:
required: true
jobs:
build_docker:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(inputs.build_platform) }}
ocaml_version: ${{ fromJson(inputs.ocaml_version) }}
include: ${{ fromJson(inputs.build_include) }}
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Download all artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: artifacts/${{ inputs.sha }}
- name: Get debian package
run: |
echo "deb-file=$(find artifacts/${{ inputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep ${{ matrix.ocaml_version }} | grep -v minimal | grep '${{ matrix.platform }}\.deb$' | grep -v dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_package
- name: Get debian debug package
run: |
echo "deb-file=$(find artifacts/${{ inputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep ${{ matrix.ocaml_version }} | grep -v minimal | grep '${{ matrix.platform }}\.deb$' | grep dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_debug_package
- name: Login to Docker Hub
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
build-args: |
"DEB_FILE=${{ steps.debian_package.outputs.deb-file }}"
"DEB_DEBUG_FILE=${{ steps.debian_debug_package.outputs.deb-file }}"
context: .
file: .github/docker/debian.dockerfile
tags: |
"savonet/liquidsoap-ci-build:${{ inputs.branch }}_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
"ghcr.io/savonet/liquidsoap-ci-build:${{ inputs.branch }}_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
push: ${{ inputs.publish_docker_image }}
provenance: false
sbom: false
build_docker_alpine:
runs-on: ${{ matrix.runs-on }}
if: inputs.is_fork != 'true'
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(inputs.build_platform) }}
ocaml_version: ${{ fromJson(inputs.ocaml_version) }}
include: ${{ fromJson(inputs.build_include) }}
exclude:
- ocaml_version: 5.2.0-ox
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Download all artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: artifacts/${{ inputs.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Get alpine package
run: |
echo "apk-file=$(find artifacts/${{ inputs.sha }} -type f | grep ${{ matrix.ocaml_version }} | grep -v minimal | grep 'apk$' | grep -v dbg | grep ${{ matrix.alpine-arch }})" >> "${GITHUB_OUTPUT}"
id: alpine_package
- name: Login to Docker Hub
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
build-args: |
"APK_FILE=${{ steps.alpine_package.outputs.apk-file }}"
context: .
file: .github/docker/alpine.dockerfile
tags: |
"savonet/liquidsoap-ci-build:${{ inputs.branch }}_alpine_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
"ghcr.io/savonet/liquidsoap-ci-build:${{ inputs.branch }}_alpine_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
push: ${{ inputs.publish_docker_image }}
provenance: false
sbom: false
build_docker_minimal:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(inputs.build_platform) }}
ocaml_version: ${{ fromJson(inputs.ocaml_version) }}
include: ${{ fromJson(inputs.build_include) }}
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Download all artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: artifacts/${{ inputs.sha }}
- name: Get debian package
run: |
echo "deb-file=$(find artifacts/${{ inputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep ${{ matrix.ocaml_version }} | grep minimal | grep '${{ matrix.platform }}\.deb$' | grep -v dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_package
- name: Get debian debug package
run: |
echo "deb-file=$(find artifacts/${{ inputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep ${{ matrix.ocaml_version }} | grep minimal | grep '${{ matrix.platform }}\.deb$' | grep dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_debug_package
- name: Login to Docker Hub
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
build-args: |
"DEB_FILE=${{ steps.debian_package.outputs.deb-file }}"
"DEB_DEBUG_FILE=${{ steps.debian_debug_package.outputs.deb-file }}"
context: .
file: .github/docker/debian.dockerfile
tags: |
"savonet/liquidsoap-ci-build:${{ inputs.branch }}-minimal_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
"ghcr.io/savonet/liquidsoap-ci-build:${{ inputs.branch }}-minimal_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
push: ${{ inputs.publish_docker_image }}
provenance: false
sbom: false
build_docker_alpine_minimal:
runs-on: ${{ matrix.runs-on }}
if: inputs.is_fork != 'true'
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(inputs.build_platform) }}
ocaml_version: ${{ fromJson(inputs.ocaml_version) }}
include: ${{ fromJson(inputs.build_include) }}
exclude:
- ocaml_version: 5.2.0-ox
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Download all artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: artifacts/${{ inputs.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Get alpine package
run: |
echo "apk-file=$(find artifacts/${{ inputs.sha }} -type f | grep minimal | grep ${{ matrix.ocaml_version }} | grep 'apk$' | grep -v dbg | grep ${{ matrix.alpine-arch }})" >> "${GITHUB_OUTPUT}"
id: alpine_package
- name: Login to Docker Hub
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: inputs.publish_docker_image == 'true'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
build-args: |
"APK_FILE=${{ steps.alpine_package.outputs.apk-file }}"
context: .
file: .github/docker/alpine.dockerfile
tags: |
"savonet/liquidsoap-ci-build:${{ inputs.branch }}-minimal_alpine_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
"ghcr.io/savonet/liquidsoap-ci-build:${{ inputs.branch }}-minimal_alpine_${{ matrix.platform }}-ocaml${{ matrix.ocaml_version }}"
push: ${{ inputs.publish_docker_image }}
provenance: false
sbom: false
build_docker_release:
runs-on: depot-ubuntu-24.04-4
needs: [build_docker, build_docker_alpine]
if: inputs.docker_release == 'true'
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Push consolidated manifest
env:
TAG: ${{ inputs.branch }}
USER: ${{ secrets.DOCKERHUB_USER }}
PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
GHCR_USER: ${{ github.actor }}
GHCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SHA: ${{ inputs.sha }}
OCAML_DOCKER_RELEASE_VERSION: ocaml${{ inputs.ocaml_docker_release_version }}
run: .github/scripts/push-docker.sh
build_docker_release_minimal:
runs-on: depot-ubuntu-24.04-4
needs: [build_docker_minimal, build_docker_alpine_minimal]
if: inputs.docker_release == 'true'
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Push consolidated manifest
env:
TAG: ${{ inputs.branch }}-minimal
USER: ${{ secrets.DOCKERHUB_USER }}
PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
GHCR_USER: ${{ github.actor }}
GHCR_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SHA: ${{ inputs.sha }}
OCAML_DOCKER_RELEASE_VERSION: ocaml${{ inputs.ocaml_docker_release_version }}
run: .github/scripts/push-docker.sh ${{ inputs.branch }}-minimal ${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PASSWORD }} ${{ github.actor }} ${{ secrets.GITHUB_TOKEN }} ${{ inputs.sha }}-minimal
|