forked from phoenix-oss/llama-stack-mirror
78 lines
2.3 KiB
YAML
78 lines
2.3 KiB
YAML
name: Build and Push container
|
|
run-name: Build and Push container
|
|
on:
|
|
workflow_dispatch:
|
|
#schedule:
|
|
# - cron: "0 10 * * *"
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- 'main'
|
|
env:
|
|
IMAGE: git.kvant.cloud/${{github.repository}}
|
|
jobs:
|
|
build_concierge_backend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set current time
|
|
uses: https://github.com/gerred/actions/current-time@master
|
|
id: current_time
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to git.kvant.cloud registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.kvant.cloud
|
|
username: ${{ vars.ORG_PACKAGE_WRITER_USERNAME }}
|
|
password: ${{ secrets.ORG_PACKAGE_WRITER_TOKEN }}
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
# list of Docker images to use as base name for tags
|
|
images: |
|
|
${{env.IMAGE}}
|
|
# generate Docker tags based on the following events/attributes
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
|
|
- name: Install uv
|
|
run: pipx install uv
|
|
|
|
- name: Build
|
|
env:
|
|
USE_COPY_NOT_MOUNT: true
|
|
LLAMA_STACK_DIR: .
|
|
run: uvx --from . llama stack build --template kvant --image-type container
|
|
|
|
- name: Build and push to gitea registry
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
context: .github/workflows
|
|
provenance: mode=max
|
|
sbom: true
|
|
build-args: |
|
|
BUILD_DATE=${{ steps.current_time.outputs.time }}
|
|
cache-from: |
|
|
type=registry,ref=${{ env.IMAGE }}:buildcache
|
|
type=registry,ref=${{ env.IMAGE }}:${{ github.ref_name }}
|
|
type=registry,ref=${{ env.IMAGE }}:main
|
|
cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max,image-manifest=true
|