Publish Docker image #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
# Run manually by clicking a button in the UI | |
workflow_dispatch: | |
# Run automatically on new commits to specific branches | |
push: | |
branches: | |
- master | |
jobs: | |
push_to_docker_hub: | |
name: ${{ matrix.docker_image}} (${{ matrix.arch }}) - build and push | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- docker_image: manylinux2014_aarch64 | |
arch: linux/arm64 | |
- docker_image: manylinux_2_28_x86_64 | |
arch: linux/amd64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract tag for Docker | |
id: tag | |
shell: bash | |
run: | | |
branch=${GITHUB_REF#refs/heads/} | |
docker_tag=${{ matrix.docker_image }}-${branch} | |
docker_tag=${docker_tag%-master} | |
echo "::set-output name=docker_tag::${docker_tag}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
if: matrix.arch != 'linux/amd64' | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ github.workspace }}/images/${{ matrix.docker_image }}/ | |
push: true | |
platforms: ${{ matrix.arch }} | |
tags: lightgbm/vsts-agent:${{ steps.tag.outputs.docker_tag }} |