Merge pull request #8 from amazeeio/dev #11
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
# this workflow is triggered by an API call when there is a new PyPI release of LiteLLM | |
name: Build, Publish LiteLLM Docker Image. | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- dev | |
# Defines two custom environment variables for the workflow. Used for the Container registry domain, and a name for the Docker image that this workflow builds. | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | |
jobs: | |
# print commit hash, tag, and release type | |
print: | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Commit hash: ${{ github.event.inputs.commit_hash }}" | |
echo "Tag: ${{ github.event.inputs.tag }}" | |
echo "Release type: ${{ github.event.inputs.release_type }}" | |
build-and-push-image-database: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for database Dockerfile | |
id: meta-database | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-database | |
# Configure multi platform Docker builds | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@e0e4588fad221d38ee467c0bffd91115366dc0c5 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@edfb0fe6204400c56fbfd3feba3fe9ad1adfa345 | |
- name: Build and push Database Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
file: ./docker/Dockerfile.database | |
push: true | |
tags: | | |
${{ steps.meta-database.outputs.tags }} | |
labels: ${{ steps.meta-database.outputs.labels }} | |
platforms: linux/amd64 | |