Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add workflow for playground image #422

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
15 changes: 13 additions & 2 deletions .github/workflows/build-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
- name: Login to ghcr.io
run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io

- name: Publish Image
id: publish-image
- name: Publish Image (Extension)
id: publish-image-extension
run: |
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/ai-studio
IMAGE_NIGHTLY=${IMAGE_NAME}:nightly
Expand All @@ -64,3 +64,14 @@ jobs:
podman push $IMAGE_NIGHTLY
podman tag $IMAGE_NIGHTLY $IMAGE_SHA
podman push $IMAGE_SHA

- name: Publish Image (Playground)
id: publish-image-playground
run: |
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/ai-studio-playground-chat
IMAGE_NIGHTLY=${IMAGE_NAME}:nightly
IMAGE_SHA=${IMAGE_NAME}:${GITHUB_SHA}
podman build -t $IMAGE_NIGHTLY packages/playground-chat
podman push $IMAGE_NIGHTLY
podman tag $IMAGE_NIGHTLY $IMAGE_SHA
podman push $IMAGE_SHA
107 changes: 107 additions & 0 deletions .github/workflows/release-playground.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#
# Copyright (C) 2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: release playground

on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
branch:
description: 'Branch to use for the release'
required: true
default: main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

jobs:

tag:
name: Tagging
runs-on: ubuntu-20.04
outputs:
githubTag: ${{ steps.TAG_UTIL.outputs.githubTag}}
imageVersion: ${{ steps.TAG_UTIL.outputs.imageVersion}}
releaseId: ${{ steps.create_release.outputs.id}}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Generate tag utilities
id: TAG_UTIL
run: |
TAG_PATTERN=${{ github.event.inputs.version }}
echo "githubTag=playground-v$TAG_PATTERN" >> ${GITHUB_OUTPUT}
echo "imageVersion=$TAG_PATTERN" >> ${GITHUB_OUTPUT}

- name: tag
run: |
git config --local user.name ${{ github.actor }}

# commit the changes
git commit -m "chore: 🥁 tagging ${{ steps.TAG_UTIL.outputs.githubTag }} 🥳"
echo "Tagging with ${{ steps.TAG_UTIL.outputs.githubTag }}"
git tag ${{ steps.TAG_UTIL.outputs.githubTag }}
git push origin ${{ steps.TAG_UTIL.outputs.githubTag }}
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.TAG_UTIL.outputs.githubTag }}
name: ${{ steps.TAG_UTIL.outputs.githubTag }}
draft: true
prerelease: false

build:
needs: [tag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ steps.TAG_UTIL.outputs.githubTag }}

- name: Login to ghcr.io
run: podman login --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io

- name: Build Image
id: build-image
run: |
podman build -t ghcr.io/${{ github.repository_owner }}/ai-studio-playground-chat:${{ needs.tag.outputs.imageVersion }} .
podman push ghcr.io/${{ github.repository_owner }}/ai-studio-playground-chat:${{ needs.tag.outputs.imageVersion }}
podman tag ghcr.io/${{ github.repository_owner }}/ai-studio-playground-chat:${{ needs.tag.outputs.imageVersion }} ghcr.io/${{ github.repository_owner }}/ai-studio:latest
podman push ghcr.io/${{ github.repository_owner }}/ai-studio-playground-chat:latest

release:
needs: [tag, build]
name: Release
runs-on: ubuntu-20.04
steps:
- name: id
run: echo the release id is ${{ needs.tag.outputs.releaseId}}

- name: Publish release
uses: StuYarrow/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ needs.tag.outputs.releaseId}}

7 changes: 7 additions & 0 deletions packages/playground/chat/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM registry.access.redhat.com/ubi9/python-39:1-165

COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY run.sh run.sh
EXPOSE 8001
ENTRYPOINT [ "sh", "run.sh" ]
1 change: 1 addition & 0 deletions packages/playground/chat/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
llama-cpp-python[server]
2 changes: 2 additions & 0 deletions packages/playground/chat/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
python -m llama_cpp.server --model ${MODEL_PATH} --host ${HOST:=0.0.0.0} --port ${PORT:=8001} --n_gpu_layers 0