MojoLlama
Archived Mojo/MAX quantizer and serving research repository (read-only history)
Brought by drakestapleton
MojoLlama / .github / workflows / docker-publish.yml
| 1 | name: Build and publish Docker images |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main] |
| 6 | tags: |
| 7 | - "v*" |
| 8 | pull_request: |
| 9 | branches: [main] |
| 10 | workflow_dispatch: |
| 11 | |
| 12 | env: |
| 13 | REGISTRY: ghcr.io |
| 14 | IMAGE_NAME: ${{ github.repository }} |
| 15 | |
| 16 | jobs: |
| 17 | build-and-push: |
| 18 | runs-on: ubuntu-latest |
| 19 | permissions: |
| 20 | contents: read |
| 21 | packages: write |
| 22 | strategy: |
| 23 | fail-fast: false |
| 24 | matrix: |
| 25 | include: |
| 26 | - name: cpu |
| 27 | dockerfile: Dockerfile |
| 28 | tag-suffix: cpu |
| 29 | - name: cuda |
| 30 | dockerfile: docker/Dockerfile.cuda |
| 31 | tag-suffix: cuda |
| 32 | - name: rocm |
| 33 | dockerfile: docker/Dockerfile.rocm |
| 34 | tag-suffix: rocm |
| 35 | - name: vulkan |
| 36 | dockerfile: docker/Dockerfile.vulkan |
| 37 | tag-suffix: vulkan |
| 38 | - name: sycl |
| 39 | dockerfile: docker/Dockerfile.sycl |
| 40 | tag-suffix: sycl |
| 41 | |
| 42 | steps: |
| 43 | - name: Checkout repository |
| 44 | uses: actions/checkout@v4 |
| 45 | |
| 46 | - name: Free disk space |
| 47 | run: | |
| 48 | sudo rm -rf /usr/share/dotnet |
| 49 | sudo rm -rf /opt/ghc |
| 50 | sudo rm -rf /usr/local/share/boost |
| 51 | sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 52 | sudo docker image prune -af |
| 53 | df -h |
| 54 | |
| 55 | - name: Log in to GitHub Container Registry |
| 56 | uses: docker/login-action@v3 |
| 57 | with: |
| 58 | registry: ${{ env.REGISTRY }} |
| 59 | username: ${{ github.actor }} |
| 60 | password: ${{ secrets.GITHUB_TOKEN }} |
| 61 | |
| 62 | - name: Extract Docker metadata |
| 63 | id: meta |
| 64 | uses: docker/metadata-action@v5 |
| 65 | with: |
| 66 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 67 | tags: | |
| 68 | type=semver,pattern={{version}}-${{ matrix.tag-suffix }} |
| 69 | type=semver,pattern={{major}}.{{minor}}-${{ matrix.tag-suffix }} |
| 70 | type=ref,event=branch,suffix=-${{ matrix.tag-suffix }} |
| 71 | type=sha,prefix=,suffix=-${{ matrix.tag-suffix }} |
| 72 | type=raw,value=latest-${{ matrix.tag-suffix }},enable={{is_default_branch}} |
| 73 | type=raw,value=${{ matrix.tag-suffix }},enable={{is_default_branch}} |
| 74 | |
| 75 | - name: Build and push Docker image |
| 76 | uses: docker/build-push-action@v6 |
| 77 | with: |
| 78 | context: . |
| 79 | file: ${{ matrix.dockerfile }} |
| 80 | push: ${{ github.event_name != 'pull_request' }} |
| 81 | tags: ${{ steps.meta.outputs.tags }} |
| 82 | labels: ${{ steps.meta.outputs.labels }} |