Merge pull request #1 from zdtsw-forking/odh #1
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: CI - Build UDS Tokenizer Image | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name == 'push' | |
| run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| shell: bash | |
| - name: Determine image tag | |
| id: tag | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" ]]; then | |
| SHA="${{ github.sha }}" | |
| SHORT_SHA="${SHA:0:7}" | |
| echo "tag=${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| echo "image=ghcr.io/${{ github.repository_owner }}/llm-d-uds-tokenizer:${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tag=pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" | |
| echo "image=llm-d-uds-tokenizer:pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| shell: bash | |
| - name: Build UDS tokenizer image | |
| run: | | |
| PUSH_ARG="" | |
| if [[ "${{ github.event_name }}" == "push" ]]; then | |
| PUSH_ARG="--push" | |
| fi | |
| docker buildx build \ | |
| --platform linux/amd64 \ | |
| -t ${{ steps.tag.outputs.image }} \ | |
| ${PUSH_ARG} \ | |
| -f services/uds_tokenizer/Dockerfile \ | |
| services/uds_tokenizer | |
| shell: bash | |
| - name: Run Trivy scan | |
| if: github.event_name == 'push' | |
| uses: ./.github/actions/trivy-scan | |
| with: | |
| image: ${{ steps.tag.outputs.image }} |