fix: add amd-optimization-test branch to workflow triggers #3
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 CPU AMD Docker Image | |
| on: | |
| push: | |
| branches: [ fix-dockerfile-issue, amd-optimization-test ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| test_tag: | |
| description: 'Custom tag for testing (optional)' | |
| required: false | |
| default: 'test-optimization' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }}/text-embeddings-inference-cpu-amd | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=sha,prefix={{branch}}- | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=raw,value=${{ github.event.inputs.test_tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test_tag != '' }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile-cpu-amd | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| GIT_SHA=${{ github.sha }} | |
| DOCKER_LABEL=${{ github.ref_name }} | |
| - name: Output image details | |
| run: | | |
| echo "🚀 AMD Optimized Image built and pushed successfully!" | |
| echo "" | |
| echo "📋 Image tags:" | |
| echo "${{ steps.meta.outputs.tags }}" | |
| echo "" | |
| echo "🧪 To test this optimized image on your AMD server:" | |
| echo "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ github.sha }}" | |
| echo "" | |
| echo "🔧 Optimizations included:" | |
| echo "- OpenBLAS for AMD CPU optimization" | |
| echo "- Auto-threading (RAYON_NUM_THREADS=0)" | |
| echo "- Zen architecture targeting" | |
| echo "" | |
| echo "⚡ Recommended run command for testing:" | |
| echo 'docker run --rm -p 8080:80 \' | |
| echo ' -v $PWD/data:/data \' | |
| echo ' -e MAX_CONCURRENT_REQUESTS=256 \' | |
| echo ' -e MAX_BATCH_TOKENS=32768 \' | |
| echo ' -e MAX_BATCH_REQUESTS=64 \' | |
| echo " ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ github.sha }} \\" | |
| echo ' --model-id Qwen/Qwen2.5-0.5B-Instruct \' | |
| echo ' --max-concurrent-requests 256 \' | |
| echo ' --max-batch-tokens 32768 \' | |
| echo ' --max-batch-requests 64' |