Merge branch 'main' of https://github.com/AMDResearch/omniprobe #9
This file contains hidden or 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: Build and Push Docker Image | |
on: | |
push: | |
branches: [ main, colramos/docker-upload ] | |
paths-ignore: | |
- '*.md' | |
- 'docs/**' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # Don't cancel other builds if one fails | |
matrix: | |
rocm-version: ['6.3', '6.4'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Read VERSION file | |
id: version | |
run: | | |
if [ -f VERSION ]; then | |
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
else | |
# Fallback to git commit hash if VERSION file doesn't exist | |
echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
fi | |
- name: Build Docker image | |
run: | | |
# Build the Docker image using the existing build script | |
./containers/build.sh --docker --rocm ${{ matrix.rocm-version }} | |
- name: Tag image for DockerHub | |
run: | | |
# Get your DockerHub username from secrets | |
DOCKERHUB_USERNAME="${{ secrets.DOCKERHUB_USERNAME }}" | |
VERSION="${{ steps.version.outputs.version }}" | |
ROCM_VERSION="${{ matrix.rocm-version }}" | |
# Tag the locally built image for DockerHub with multiple tags | |
docker tag omniprobe:${VERSION}-rocm${ROCM_VERSION} ${DOCKERHUB_USERNAME}/omniprobe:${VERSION}-rocm${ROCM_VERSION} | |
docker tag omniprobe:${VERSION}-rocm${ROCM_VERSION} ${DOCKERHUB_USERNAME}/omniprobe:latest-rocm${ROCM_VERSION} | |
- name: Push to DockerHub | |
run: | | |
DOCKERHUB_USERNAME="${{ secrets.DOCKERHUB_USERNAME }}" | |
VERSION="${{ steps.version.outputs.version }}" | |
ROCM_VERSION="${{ matrix.rocm-version }}" | |
# Push version-specific and ROCm-specific tags | |
docker push ${DOCKERHUB_USERNAME}/omniprobe:${VERSION}-rocm${ROCM_VERSION} | |
docker push ${DOCKERHUB_USERNAME}/omniprobe:latest-rocm${ROCM_VERSION} | |
- name: Image digest | |
run: | | |
DOCKERHUB_USERNAME="${{ secrets.DOCKERHUB_USERNAME }}" | |
VERSION="${{ steps.version.outputs.version }}" | |
ROCM_VERSION="${{ matrix.rocm-version }}" | |
echo "Image pushed: ${DOCKERHUB_USERNAME}/omniprobe:${VERSION}-rocm${ROCM_VERSION}" | |
echo "Image pushed: ${DOCKERHUB_USERNAME}/omniprobe:latest-rocm${ROCM_VERSION}" |