Build TT SMI Docker image #1
Workflow file for this run
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 TT SMI Docker image | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| image_name: | |
| description: "Docker image name" | |
| required: true | |
| default: "dstackai/tt-smi" | |
| tt_smi_version: | |
| description: "TT SMI version" | |
| required: true | |
| default: "3.0.25" | |
| tag_latest: | |
| description: "Update 'latest'" | |
| type: boolean | |
| required: true | |
| default: false | |
| jobs: | |
| build-tt-smi: | |
| defaults: | |
| run: | |
| working-directory: docker/tt-smi | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and upload to DockerHub | |
| run: | | |
| IMAGE_NAME=${{ inputs.image_name }} | |
| docker buildx build . \ | |
| --load \ | |
| --provenance=false \ | |
| --platform linux/amd64 \ | |
| --build-arg IMAGE_NAME=${IMAGE_NAME} \ | |
| --build-arg TT_SMI_VERSION=${{ inputs.tt_smi_version }} \ | |
| --build-arg BUILD_DATE=$(date --utc --iso-8601=seconds)Z \ | |
| --tag ${IMAGE_NAME}:${{ inputs.tt_smi_version }} | |
| VERSION=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' ${IMAGE_NAME}:${{ inputs.tt_smi_version }}) | |
| docker tag ${IMAGE_NAME}:${{ inputs.tt_smi_version }} ${IMAGE_NAME}:${VERSION} | |
| docker push ${IMAGE_NAME}:${VERSION} | |
| - name: Tag and push latest | |
| if: ${{ inputs.tag_latest }} | |
| run: | | |
| docker tag ${{ inputs.image_name }}:${{ inputs.tt_smi_version }} ${{ inputs.image_name }}:latest | |
| docker push ${{ inputs.image_name }}:latest |