Skip to content

Docker support.

Docker support. #5

name: Build and Publish Docker Images
permissions:
packages: write
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
tags:
- v[0-9]+.*
branches:
- feat/docker
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-publish:
runs-on: ubuntu-latest
strategy:
# Prevent a failure in one image from stopping the other builds
fail-fast: false
matrix:
include:
- image: routellm
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
device: cpu
- image: routellm
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
device: cuda
suffix: -cuda
- image: routellm
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
device: rocm
suffix: -rocm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/routellm
# generate Docker tags based on the following events/attributes
tags: |
# Tag with branch name
type=ref,event=branch,suffix=${{ matrix.suffix }}
# Tag with pr-number
type=ref,event=pr,suffix=${{ matrix.suffix }}
# Tag with git tag on release
type=ref,event=tag,suffix=${{ matrix.suffix }}
type=raw,value=release,enable=${{ github.event_name == 'release' }},suffix=${{ matrix.suffix }}
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/[email protected]
with:
context: ${{ matrix.context }}
file: ${{ matrix.file }}
platforms: ${{ matrix.platforms }}
build-args: |
TARGET=${{ matrix.device }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}