Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .github/workflows/build-and-push.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build dev image

on:
pull_request:
branches:
- dev
push:
branches:
- dev

jobs:
build-dev:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: llamastack-dist-ui
context: frontend
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Generate dev tag
id: tag
run: |
short_sha=$(git rev-parse --short HEAD)
if [ "${{ github.event_name }}" == "pull_request" ]; then
# PR build: dev-pr123-abc1234
echo "value=dev-pr${{ github.event.pull_request.number }}-${short_sha}" >> $GITHUB_OUTPUT
else
# Push to dev: dev-abc1234
echo "value=dev-${short_sha}" >> $GITHUB_OUTPUT
fi

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
file: ${{ matrix.context }}/Containerfile
push: true
tags: quay.io/yuvalturg/${{ matrix.name }}:${{ steps.tag.outputs.value }}
cache-from: type=registry,ref=quay.io/yuvalturg/${{ matrix.name }}:buildcache
cache-to: type=registry,ref=quay.io/yuvalturg/${{ matrix.name }}:buildcache,mode=max

- name: Comment on PR with image tag
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `✅ Built image: \`quay.io/yuvalturg/${{ matrix.name }}:${{ steps.tag.outputs.value }}\``
})
94 changes: 94 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Create Release PR

on:
workflow_dispatch:
branches:
- dev
inputs:
version_bump:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major
default: 'patch'

jobs:
create-release-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout dev branch
uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0

- name: Get current version
id: current_version
run: |
version=$(grep '^version:' deploy/helm/rag/Chart.yaml | awk '{print $2}')
echo "version=$version" >> $GITHUB_OUTPUT

- name: Calculate new version
id: new_version
run: |
current="${{ steps.current_version.outputs.version }}"
IFS='.' read -r major minor patch <<< "$current"

case "${{ inputs.version_bump }}" in
major)
new_version="$((major + 1)).0.0"
;;
minor)
new_version="${major}.$((minor + 1)).0"
;;
patch)
new_version="${major}.${minor}.$((patch + 1))"
;;
esac

echo "version=$new_version" >> $GITHUB_OUTPUT
echo "New version will be: $new_version"

- name: Update Chart version
run: |
sed -i "s/^version: .*/version: ${{ steps.new_version.outputs.version }}/" deploy/helm/rag/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${{ steps.new_version.outputs.version }}\"/" deploy/helm/rag/Chart.yaml

- name: Commit version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b release/v${{ steps.new_version.outputs.version }}
git add deploy/helm/rag/Chart.yaml
git commit -m "chore: bump version to ${{ steps.new_version.outputs.version }}"
git push origin release/v${{ steps.new_version.outputs.version }}

- name: Create Pull Request
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr create \
--title "Release v${{ steps.new_version.outputs.version }}" \
--body "$(cat <<'EOF'
## Release v${{ steps.new_version.outputs.version }}

This PR merges changes from \`dev\` to \`main\` for release v${{ steps.new_version.outputs.version }}.

### Changes
$(git log main..dev --oneline --no-merges | head -20)

### Checklist
- [ ] All tests passing
- [ ] Documentation updated
- [ ] Breaking changes documented (if any)

After merging, this will automatically:
- Create git tag v${{ steps.new_version.outputs.version }}
- Build and push Docker images
EOF
)" \
--base main \
--head release/v${{ steps.new_version.outputs.version }}
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release

on:
pull_request:
types: [closed]
branches:
- main

jobs:
release:
if: |
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: llamastack-dist-ui
context: frontend
chart: deploy/helm/rag/Chart.yaml
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version from Chart.yaml
id: version
run: |
version=$(grep '^version:' ${{ matrix.chart }} | awk '{print $2}')
echo "value=$version" >> $GITHUB_OUTPUT

- name: Delete release branch
run: |
git push origin --delete ${{ github.event.pull_request.head.ref }} || true

- name: Create git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.version.outputs.value }}" -m "Release v${{ steps.version.outputs.value }}" || true
git push origin "v${{ steps.version.outputs.value }}" || true

- name: Install Helm
uses: azure/setup-helm@v4
with:
version: 'latest'

- name: Update Helm dependencies
run: |
helm dependency update deploy/helm/rag

- name: Package Helm chart
run: |
helm package deploy/helm/rag -d .
ls -la rag-*.tgz

- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v${{ steps.version.outputs.value }}" \
--title "Release v${{ steps.version.outputs.value }}" \
--notes "Release v${{ steps.version.outputs.value }}" \
--latest \
rag-${{ steps.version.outputs.value }}.tgz || true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
file: ${{ matrix.context }}/Containerfile
push: true
tags: quay.io/yuvalturg/${{ matrix.name }}:${{ steps.version.outputs.value }}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!-- omit from toc -->
# Centralize company knowledge with an Enterprise RAG Chatbot

asdf

kuku

Use retrieval-augmented generation (RAG) to enhance large language models with specialized data sources for more accurate and context-aware responses.

<!-- omit from toc -->
Expand Down
4 changes: 2 additions & 2 deletions deploy/local/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PROJECT_NAME := rag
OLLAMA_MODEL := llama3.2:3b-instruct-fp16

# UI Build Configuration
VERSION ?= 0.2.22
VERSION ?= 0.2.23
TAVILY_SEARCH_API_KEY ?= ""
CONTAINER_REGISTRY ?= quay.io/rh-ai-quickstart
DIST_UI_DIR := $(abspath ../../frontend)
Expand Down Expand Up @@ -296,7 +296,7 @@ config: ## Show current configuration
# UI Build and Deployment Targets
build-ui: ## Build the RAG UI container locally
@echo "$(BLUE)[INFO]$(NC) Building RAG UI container for $(PLATFORM)..."
@podman build --platform $(PLATFORM) --build-arg IMAGE_TAG=$(VERSION) -t llamastack-dist-ui:$(VERSION) -f $(DIST_UI_DIR)/Containerfile $(DIST_UI_DIR)
@podman build --platform $(PLATFORM) -t llamastack-dist-ui:$(VERSION) -f $(DIST_UI_DIR)/Containerfile $(DIST_UI_DIR)
@echo "$(GREEN)[SUCCESS]$(NC) RAG UI container built successfully."

build-and-push-ui: build-ui ## Build and push UI container to registry
Expand Down
2 changes: 0 additions & 2 deletions deploy/local/podman-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ services:
build:
context: ../../frontend
dockerfile: Containerfile
args:
IMAGE_TAG: "0.2.9"
container_name: rag-ui
depends_on:
llamastack:
Expand Down
25 changes: 8 additions & 17 deletions frontend/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@

FROM python:3.12-slim

ARG IMAGE_TAG
WORKDIR /app
COPY . /app/

# Install uv first (rarely changes)
RUN pip install uv

# Make sure IMAGE_TAG is set
RUN if [ -z "$IMAGE_TAG" ]; then echo "IMAGE_TAG is not set"; exit 1; fi
# Copy dependency file first (for better caching)
COPY pyproject.toml ./

# Replace __LLAMASTACK_VERSION__ with actual version in pyproject.toml
RUN sed -i "s/__LLAMASTACK_VERSION__/${IMAGE_TAG}/g" pyproject.toml
# Install dependencies only (cached unless pyproject.toml changes)
RUN uv pip install --system -r pyproject.toml

# Install uv
RUN pip install uv
# Copy application code (invalidates cache only on code changes)
COPY . /app/

# Set UV cache directory to a writable location
ENV UV_CACHE_DIR=/app/.uv-cache
Expand All @@ -25,15 +25,6 @@ ENV XDG_CACHE_HOME=/app/.cache
RUN mkdir -p /app/.uv-cache /app/.cache && \
chmod -R 777 /app/.uv-cache /app/.cache

# Install dependencies using uv
RUN if [ -f "uv.lock" ]; then \
echo "Lockfile found, using frozen sync"; \
uv sync --frozen; \
else \
echo "Lockfile not found, creating new one"; \
uv sync; \
fi

# Ensure all app files have proper ownership and permissions for non-root users
RUN chown -R 1001:0 /app && \
chmod -R g+rwX /app
Expand Down
4 changes: 2 additions & 2 deletions frontend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ requires-python = ">=3.12"
dependencies = [
"streamlit",
"pandas",
"llama-stack-client==__LLAMASTACK_VERSION__",
"llama-stack-client==0.2.23",
"requests",
"streamlit-option-menu",
"llama-stack==__LLAMASTACK_VERSION__",
"llama-stack==0.2.23",
"fire",
]

Expand Down
Loading