Skip to content

Commit

Permalink
initial gh actions
Browse files Browse the repository at this point in the history
Signed-off-by: sallyom <[email protected]>
  • Loading branch information
sallyom committed Feb 13, 2024
1 parent 0ebb401 commit 768313e
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 3 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Sample applications build,test,push images

# Build image once the PR is merged to main branch.
on:
pull_request:
workflow_dispatch:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest # windows-latest || macos-latest
env:
REGISTRY: quay.io
# github.repository as <account>/<repo>
MODEL_SERVICE_IMAGE: redhat-et/locallm-model-service
CHATBOT_IMAGE: redhat-et/locallm-chatbot
SUMMARIZER_IMAGE: redhat-et/locallm-text-summarizer
RAG_IMAGE: redhat-et/locallm-rag
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

- name: Get changed model-service files
id: changed-files-model-service
uses: tj-actions/changed-files@v42
with:
files: |
playground/**
- name: Get changed rag files
id: changed-files-rag
uses: tj-actions/changed-files@v42
with:
files: |
rag-langchain/**
- name: Get changed summarizer files
id: changed-files-summarizer
uses: tj-actions/changed-files@v42
with:
files: |
summarizer-langchain/**
- name: Get changed chatbot files
id: changed-files-chatbot
uses: tj-actions/changed-files@v42
with:
files: |
chatbot-langchain/**
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build model-service
if: steps.changed-files-model-service.outputs.any_changed == 'true'
id: build_model_service_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.MODEL_SERVICE_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: playground
containerfiles: ./playground/Containerfile

- name: Build chatbot
id: build_chatbot_multiplatform
uses: redhat-actions/buildah-build@v2
if: steps.changed-files-chatbot-langchain.outputs.any_changed == 'true'
with:
image: ${{ env.CHATBOT_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: chatbot-langchain
containerfiles: |
./chatbot-langchain/builds/Containerfile
- name: Build summarizer
if: steps.changed-files-summarizer.outputs.any_changed == 'true'
id: build_summarizer_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.SUMMARIZER_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: summarizer-langchain
containerfiles: |
./summarizer-langchain/builds/Containerfile
- name: Build RAG
if: steps.changed-files-rag.outputs.any_changed == 'true'
id: build_rag_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.RAG_IMAGE }}
tags: latest ${{ github.sha }}
# TODO: add amd64
platforms: linux/arm64
context: rag-langchain
containerfiles: |
./rag-langchain/builds/Containerfile
121 changes: 121 additions & 0 deletions .github/workflows/build-push-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Sample applications build & push images

on:
push:
branches: [ main ]
workflow_dispatch:

permissions: write-all

jobs:
build:
env:
REGISTRY: quay.io/redhat-et
#GH_REGISTRY: ghcr.io
# github.repository as <account>/<repo>
MODEL_SERVICE_IMAGE: locallm-model-service
CHATBOT_IMAGE: locallm-chatbot
SUMMARIZER_IMAGE: locallm-text-summarizer
RAG_IMAGE: locallm-rag
runs-on: ubuntu-latest # windows-latest || macos-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

#- name: Log in to ghcr.io
# uses: redhat-actions/podman-login@v1
# with:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# registry: ${{ env.GH_REGISTRY }}

- name: Login Quay Container registry
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build model-service
id: build_model_service_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.MODEL_SERVICE_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: ./playground
containerfiles: |
./playground/Containerfile
- name: Push model-service image
id: push_model_service
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_model_service_multiplatform.outputs.image }}
tags: ${{ steps.build_model_service_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}

- name: Build chatbot
id: build_chatbot_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.CHATBOT_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: chatbot-langchain
containerfiles: |
./chatbot-langchain/builds/Containerfile
- name: Push chatbot image
id: push_chatbot
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_chatbot_multiplatform.outputs.image }}
tags: ${{ steps.build_chatbot_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}

- name: Build summarizer
id: build_summarizer_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.SUMMARIZER_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: ./summarizer-langchain
containerfiles: |
./summarizer-langchain/builds/Containerfile
- name: Push summarizer image
id: push_summarizer
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_summarizer_multiplatform.outputs.image }}
tags: ${{ steps.build_summarizer_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}

- name: Build RAG
id: build_rag_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.RAG_IMAGE }}
tags: latest ${{ github.sha }}
#TODO: add amd64
platforms: linux/arm64
context: ./rag-langchain
containerfiles: |
./rag-langchain/builds/Containerfile
- name: Push rag image
id: push_rag
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_rag_multiplatform.outputs.image }}
tags: ${{ steps.build_rag_multiplatform.outputs.tags }}
registry: ${{ env.REGISTRY }}
3 changes: 2 additions & 1 deletion chatbot-langchain/builds/Containerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM registry.access.redhat.com/ubi9/python-39:latest
LABEL org.opencontainers.image.source="https://github.com/redhat-et/locallm"
WORKDIR /chat
COPY builds/requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /chat/requirements.txt
COPY chatbot_ui.py .
EXPOSE 8501
ENTRYPOINT [ "streamlit", "run", "chatbot_ui.py" ]
ENTRYPOINT [ "streamlit", "run", "chatbot_ui.py" ]
1 change: 1 addition & 0 deletions playground/Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM registry.access.redhat.com/ubi9/python-39:latest
LABEL org.opencontainers.image.source="https://github.com/redhat-et/locallm"
WORKDIR /locallm
COPY requirements.txt /locallm/requirements.txt
RUN pip install --upgrade pip
Expand Down
3 changes: 2 additions & 1 deletion rag-langchain/builds/Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM registry.access.redhat.com/ubi9/python-39:latest
LABEL org.opencontainers.image.source="https://github.com/redhat-et/locallm"
### Update sqlite for chroma
USER root
RUN dnf remove sqlite3 -y
Expand All @@ -18,4 +19,4 @@ RUN pip install --no-cache-dir --upgrade -r /rag/requirements.txt
COPY rag_app.py .
EXPOSE 8501
ENV HF_HUB_CACHE=/rag/models/
ENTRYPOINT [ "streamlit", "run" ,"rag_app.py" ]
ENTRYPOINT [ "streamlit", "run" ,"rag_app.py" ]
3 changes: 2 additions & 1 deletion summarizer-langchain/builds/Containerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM registry.access.redhat.com/ubi9/python-39:latest
LABEL org.opencontainers.image.source="https://github.com/redhat-et/locallm"
WORKDIR /summarizer
COPY builds/requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /summarizer/requirements.txt
COPY summarizer.py .
EXPOSE 8501
ENTRYPOINT [ "streamlit", "run", "summarizer.py" ]
ENTRYPOINT [ "streamlit", "run", "summarizer.py" ]

0 comments on commit 768313e

Please sign in to comment.