diff --git a/.github/workflows/publish-docker-full-amd64.yml b/.github/workflows/publish-docker-full-amd64.yml new file mode 100644 index 00000000..f929e9a0 --- /dev/null +++ b/.github/workflows/publish-docker-full-amd64.yml @@ -0,0 +1,46 @@ +name: Docker Full AMD64 +on: + release: + types: [created] + +jobs: + build: + name: Build full Docker image for AMD64 + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Build and push full AMD64 image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + platforms: linux/amd64 + tags: | + ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-amd64 + ghcr.io/${{ github.repository }}:latest-amd64 + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.description=OptiLLM full image with model serving and API routing capabilities (AMD64) + org.opencontainers.image.licenses=Apache-2.0 + org.opencontainers.image.version=${{ steps.version.outputs.VERSION }} + cache-from: type=gha,scope=full-amd64 + cache-to: type=gha,scope=full-amd64,mode=max \ No newline at end of file diff --git a/.github/workflows/publish-docker-full-arm64.yml b/.github/workflows/publish-docker-full-arm64.yml new file mode 100644 index 00000000..b8db6f5f --- /dev/null +++ b/.github/workflows/publish-docker-full-arm64.yml @@ -0,0 +1,49 @@ +name: Docker Full ARM64 +on: + release: + types: [created] + +jobs: + build: + name: Build full Docker image for ARM64 + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Build and push full ARM64 image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + platforms: linux/arm64 + tags: | + ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-arm64 + ghcr.io/${{ github.repository }}:latest-arm64 + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.description=OptiLLM full image with model serving and API routing capabilities (ARM64) + org.opencontainers.image.licenses=Apache-2.0 + org.opencontainers.image.version=${{ steps.version.outputs.VERSION }} + cache-from: type=gha,scope=full-arm64 + cache-to: type=gha,scope=full-arm64,mode=max \ No newline at end of file diff --git a/.github/workflows/publish-docker-manifest.yml b/.github/workflows/publish-docker-manifest.yml new file mode 100644 index 00000000..89b778ec --- /dev/null +++ b/.github/workflows/publish-docker-manifest.yml @@ -0,0 +1,123 @@ +name: Docker Multi-arch Manifests +on: + workflow_run: + workflows: + - "Docker Proxy AMD64" + - "Docker Proxy ARM64" + - "Docker Full AMD64" + - "Docker Full ARM64" + types: [completed] + +jobs: + check-builds: + name: Check if all builds succeeded + runs-on: ubuntu-latest + outputs: + all-success: ${{ steps.check.outputs.result }} + version: ${{ steps.version.outputs.VERSION }} + steps: + - name: Check workflow results + id: check + uses: actions/github-script@v7 + with: + script: | + const workflows = [ + "Docker Proxy AMD64", + "Docker Proxy ARM64", + "Docker Full AMD64", + "Docker Full ARM64" + ]; + + const runId = context.payload.workflow_run.id; + const ref = context.payload.workflow_run.head_sha; + + console.log(`Checking workflows for ref: ${ref}`); + + // Get all workflow runs for this ref + const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + head_sha: ref, + status: 'completed' + }); + + const workflowResults = {}; + + for (const run of runs.workflow_runs) { + if (workflows.includes(run.name)) { + workflowResults[run.name] = run.conclusion; + console.log(`${run.name}: ${run.conclusion}`); + } + } + + // Check if all workflows succeeded + const allSuccess = workflows.every(name => + workflowResults[name] === 'success' + ); + + console.log(`All workflows successful: ${allSuccess}`); + + return allSuccess; + + - name: Extract version from workflow + id: version + run: | + VERSION=$(echo "${{ github.event.workflow_run.head_branch }}" | sed 's/refs\/tags\///') + if [[ $VERSION != v* ]]; then + # If not a version tag, use the tag from the triggering release + VERSION="${{ github.event.workflow_run.head_branch }}" + fi + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION" + + create-manifests: + name: Create multi-arch manifests + runs-on: ubuntu-latest + needs: check-builds + if: needs.check-builds.outputs.all-success == 'true' + permissions: + contents: read + packages: write + steps: + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create proxy multi-arch manifest + run: | + VERSION="${{ needs.check-builds.outputs.version }}" + + # Create versioned proxy manifest + docker manifest create ghcr.io/${{ github.repository }}:${VERSION}-proxy \ + ghcr.io/${{ github.repository }}:${VERSION}-proxy-amd64 \ + ghcr.io/${{ github.repository }}:${VERSION}-proxy-arm64 + + docker manifest push ghcr.io/${{ github.repository }}:${VERSION}-proxy + + # Create latest proxy manifest + docker manifest create ghcr.io/${{ github.repository }}:latest-proxy \ + ghcr.io/${{ github.repository }}:latest-proxy-amd64 \ + ghcr.io/${{ github.repository }}:latest-proxy-arm64 + + docker manifest push ghcr.io/${{ github.repository }}:latest-proxy + + - name: Create full multi-arch manifest + run: | + VERSION="${{ needs.check-builds.outputs.version }}" + + # Create versioned full manifest + docker manifest create ghcr.io/${{ github.repository }}:${VERSION} \ + ghcr.io/${{ github.repository }}:${VERSION}-amd64 \ + ghcr.io/${{ github.repository }}:${VERSION}-arm64 + + docker manifest push ghcr.io/${{ github.repository }}:${VERSION} + + # Create latest full manifest + docker manifest create ghcr.io/${{ github.repository }}:latest \ + ghcr.io/${{ github.repository }}:latest-amd64 \ + ghcr.io/${{ github.repository }}:latest-arm64 + + docker manifest push ghcr.io/${{ github.repository }}:latest \ No newline at end of file diff --git a/.github/workflows/publish-docker-proxy-amd64.yml b/.github/workflows/publish-docker-proxy-amd64.yml new file mode 100644 index 00000000..82357726 --- /dev/null +++ b/.github/workflows/publish-docker-proxy-amd64.yml @@ -0,0 +1,46 @@ +name: Docker Proxy AMD64 +on: + release: + types: [created] + +jobs: + build: + name: Build proxy Docker image for AMD64 + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Build and push proxy AMD64 image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.proxy_only + push: true + platforms: linux/amd64 + tags: | + ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-proxy-amd64 + ghcr.io/${{ github.repository }}:latest-proxy-amd64 + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.description=OptiLLM proxy-only image for API routing without model serving capabilities (AMD64) + org.opencontainers.image.licenses=Apache-2.0 + org.opencontainers.image.version=${{ steps.version.outputs.VERSION }} + cache-from: type=gha,scope=proxy-amd64 + cache-to: type=gha,scope=proxy-amd64,mode=max \ No newline at end of file diff --git a/.github/workflows/publish-docker-proxy-arm64.yml b/.github/workflows/publish-docker-proxy-arm64.yml new file mode 100644 index 00000000..a31cf247 --- /dev/null +++ b/.github/workflows/publish-docker-proxy-arm64.yml @@ -0,0 +1,49 @@ +name: Docker Proxy ARM64 +on: + release: + types: [created] + +jobs: + build: + name: Build proxy Docker image for ARM64 + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Build and push proxy ARM64 image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.proxy_only + push: true + platforms: linux/arm64 + tags: | + ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-proxy-arm64 + ghcr.io/${{ github.repository }}:latest-proxy-arm64 + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.description=OptiLLM proxy-only image for API routing without model serving capabilities (ARM64) + org.opencontainers.image.licenses=Apache-2.0 + org.opencontainers.image.version=${{ steps.version.outputs.VERSION }} + cache-from: type=gha,scope=proxy-arm64 + cache-to: type=gha,scope=proxy-arm64,mode=max \ No newline at end of file diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 00000000..9ba84489 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,29 @@ +name: Upload Python Package to PyPI on Release +on: + release: + types: [created] + +jobs: + pypi-publish: + name: Publish release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/optillm + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: | + python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index be53dc52..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: Upload Python Package and Docker Image on Release -on: - release: - types: [created] - -jobs: - pypi-publish: - name: Publish release to PyPI - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/optillm - permissions: - id-token: write - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: | - python -m build - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - docker-publish: - name: Publish Docker image - runs-on: ubuntu-22.04 - needs: pypi-publish - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - # Add aggressive cleanup before any Docker operations - - name: Free disk space - run: | - # Clean Docker - docker system prune -af - docker image prune -af - docker builder prune -af - - df -h - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:buildx-stable-1 - network=host - buildkitd-flags: --debug - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata for proxy_only image - - name: Extract metadata for proxy_only Docker - id: meta-proxy - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository }} - flavor: | - suffix=-proxy - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest - - # Build and push proxy_only multi-arch - - name: Build and push proxy_only Docker image (multi-arch) - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.proxy_only - push: true - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta-proxy.outputs.tags }} - labels: ${{ steps.meta-proxy.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - outputs: type=registry,compression=zstd,compression-level=5 - - # Cleanup after proxy build - - name: Cleanup after proxy build - run: | - docker system prune -af - docker builder prune -af - df -h - - # Extract metadata for full image - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - latest - - # Build full image multi-arch - - name: Build and push Docker image (multi-arch) - uses: docker/build-push-action@v5 - with: - context: . - push: true - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - outputs: type=registry,compression=zstd,compression-level=5 diff --git a/optillm/__init__.py b/optillm/__init__.py index fdd03993..5c521dfa 100644 --- a/optillm/__init__.py +++ b/optillm/__init__.py @@ -2,7 +2,7 @@ import os # Version information -__version__ = "0.1.27" +__version__ = "0.1.28" # Get the path to the root optillm.py spec = util.spec_from_file_location( diff --git a/pyproject.toml b/pyproject.toml index 6a4ee4b3..a04cb260 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "optillm" -version = "0.1.27" +version = "0.1.28" description = "An optimizing inference proxy for LLMs." readme = "README.md" license = "Apache-2.0"