Skip to content

Commit

Permalink
Move application into app directory rather then builds
Browse files Browse the repository at this point in the history
Builds is too generic and difficult to understand.
Also move all app content into the build directory
to make it easier to find and work with.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Apr 10, 2024
1 parent cd6730d commit ee80b4f
Show file tree
Hide file tree
Showing 34 changed files with 55 additions and 55 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ailab_image_build_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ jobs:
image: ${{ env.RAG_IMAGE_NAME }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
containerfiles: ./recipes/natural_language_processing/rag/builds/Containerfile
context: recipes/natural_language_processing/rag
containerfiles: ./recipes/natural_language_processing/rag/app/Containerfile
context: recipes/natural_language_processing/rag/app

- name: Login to quay.io
uses: redhat-actions/podman-login@v1
Expand Down Expand Up @@ -246,8 +246,8 @@ jobs:
image: ${{ env.CHATBOT_IMAGE_NAME }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
containerfiles: ./recipes/natural_language_processing/chatbot/builds/Containerfile
context: recipes/natural_language_processing/chatbot
containerfiles: ./recipes/natural_language_processing/chatbot/app/Containerfile
context: recipes/natural_language_processing/chatbot/app

- name: Login to quay.io
uses: redhat-actions/podman-login@v1
Expand Down Expand Up @@ -286,8 +286,8 @@ jobs:
image: ${{ env.SUMMARIZER_IMAGE_NAME }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
containerfiles: ./recipes/natural_language_processing/summarizer/builds/Containerfile
context: recipes/natural_language_processing/summarizer
containerfiles: ./recipes/natural_language_processing/summarizer/app/Containerfile
context: recipes/natural_language_processing/summarizer/app

- name: Login to quay.io
uses: redhat-actions/podman-login@v1
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: tj-actions/changed-files@v42
with:
files: |
recipes/natural_language_processing/code-generation/**
recipes/natural_language_processing/codegen/**
- name: Get changed chromadb files
id: changed-files-chromadb
Expand All @@ -75,19 +75,19 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build code-generation
- name: Build codegen
if: steps.changed-files-codegen.outputs.any_changed == 'true'
id: build_codegen_multiplatform
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.CODEGEN_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: recipes/natural_language_processing/code-generation
context: recipes/natural_language_processing/codegen/app
containerfiles: |
./recipes/natural_language_processing/code-generation/builds/Containerfile
./recipes/natural_language_processing/codegen/app/Containerfile
- name: Push code-generation image
- name: Push codegen image
id: push_codegen
if: >
(steps.changed-files-codegen.outputs.any_changed == 'true') &&
Expand All @@ -107,9 +107,9 @@ jobs:
image: ${{ env.SUMMARIZER_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/amd64, linux/arm64
context: recipes/natural_language_processing/summarizer
context: recipes/natural_language_processing/summarizer/app
containerfiles: |
./recipes/natural_language_processing/summarizer/builds/Containerfile
./recipes/natural_language_processing/summarizer/app/Containerfile
- name: Push summarizer image
id: push_summarizer
Expand All @@ -131,9 +131,9 @@ jobs:
image: ${{ env.RAG_IMAGE }}
tags: latest ${{ github.sha }}
platforms: linux/arm64, linux/amd64
context: recipes/natural_language_processing/rag
context: recipes/natural_language_processing/rag/app
containerfiles: |
./recipes/natural_language_processing/rag/builds/Containerfile
./recipes/natural_language_processing/rag/app/Containerfile
- name: Push rag image
id: push_rag
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/chatbot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
image: ${{ env.REGISTRY }}/containers/${{ env.IMAGE_NAME }}
tags: latest
platforms: linux/amd64, linux/arm64
containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/builds/Containerfile
context: recipes/natural_language_processing/${{ env.IMAGE_NAME }}
containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app/Containerfile
context: recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app

- name: Set up Python
uses: actions/[email protected]
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Recipes are currently organized by category: `audio/`, `computer_vision/`, `mult
Inside of the new directory you should add the following files:

* `ai-lab.yaml`
* `builds/Containerfile`
* `builds/requirements.txt`
* `app/Containerfile`
* `app/requirements.txt`
* `<NEW_RECIPE>_ui.py`
* `README.md`

Expand Down Expand Up @@ -53,7 +53,7 @@ application:
image: quay.io/ai-lab/llamacppp-python:latest
- name: streamlit-chat-app
contextdir: .
containerfile: builds/Containerfile
containerfile: app/Containerfile
arch:
- arm64
- amd64
Expand All @@ -64,14 +64,14 @@ application:
You can use this example as your template and change the fields where needed to define your own recipe.
### builds/Containerfile
### app/Containerfile
This will be the Containerfile used to build the client side image of your AI application. Whenever possible, we will use Red Hat's UBI as our base image. Below please see an example from the chatbot recipe.
```Dockerfile
FROM registry.access.redhat.com/ubi9/python-311:1-52
WORKDIR /chat
COPY builds/requirements.txt .
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /chat/requirements.txt
COPY chatbot_ui.py .
Expand All @@ -81,7 +81,7 @@ ENTRYPOINT [ "streamlit", "run", "chatbot_ui.py" ]

You can use this example as your template and change the fields where needed to define your own Containerfile.

### builds/requirements.txt
### app/requirements.txt

You need to include a requirements.txt file here as well so that we ensure the correct dependencies get built into our application.

Expand Down Expand Up @@ -167,4 +167,4 @@ Every vector database needs a README.md that specifies how to build, deploy and

## Additional Contributions

If you would like to contribute in some other way not outlined here, please feel free to open a [PR](https://github.com/containers/ai-lab-recipes/pulls) or an [Issue](https://github.com/containers/ai-lab-recipes/issues) in this repository and one of our maintainers will follow up. Thanks!
If you would like to contribute in some other way not outlined here, please feel free to open a [PR](https://github.com/containers/ai-lab-recipes/pulls) or an [Issue](https://github.com/containers/ai-lab-recipes/issues) in this repository and one of our maintainers will follow up. Thanks!
2 changes: 1 addition & 1 deletion recipes/audio/audio_to_text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ image from the `audio-to-text/` directory.

```bash
cd audio-to-text
podman build -t audio-to-text . -f builds/Containerfile
podman build -t audio-to-text app
```
### Deploy the AI Application

Expand Down
6 changes: 3 additions & 3 deletions recipes/audio/audio_to_text/ai-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ application:
- 8001
image: quay.io/redhat-et/locallm-whispercpp-service:latest
- name: whispercpp-app
contextdir: .
containerfile: builds/Containerfile
contextdir: app
containerfile: app/Containerfile
arch:
- arm64
- amd64
ports:
- 8501
image: quay.io/redhat-et/locallm-whisper-client:latest
image: quay.io/redhat-et/locallm-whisper-client:latest
4 changes: 2 additions & 2 deletions recipes/common/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ UNZIP_EXISTS ?= $(shell command -v unzip)

.PHONY: build
build:
podman build --squash-all $${ARCH:+--arch $${ARCH}} $${FROM:+--from $${FROM}} -f builds/Containerfile -t ${APP_IMAGE} .
podman build --squash-all $${ARCH:+--arch $${ARCH}} $${FROM:+--from $${FROM}} -t ${APP_IMAGE} app/

.PHONY: bootc
bootc: quadlet
Expand Down Expand Up @@ -152,7 +152,7 @@ run:
clean:
-rm -rf build
-rm -rf tests/__pycache__
-rm ./$(MODEL_NAME) &> /dev/null
-rm -f ./$(MODEL_NAME) &> /dev/null

.PHONY: check-model-in-path
check-model-in-path:
Expand Down
4 changes: 2 additions & 2 deletions recipes/multimodal/image_understanding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### Build image
```bash
cd image_understanding
podman build -t image_understanding . -f builds/Containerfile
podman build -t image_understanding app
```

### Run the Multimodal Model Server:
Expand Down Expand Up @@ -36,4 +36,4 @@ podman run --rm -it -p 8501:8501 -e MODEL_SERVICE_ENDPOINT=http://10.88.0.1:8001
Interact with the application from your local browser at `localhost:8501`. You can upload an image file from your host machine and the app will provide a natural language description of the image.


![](/assets/image_analysis.png)
![](/assets/image_analysis.png)
6 changes: 3 additions & 3 deletions recipes/multimodal/image_understanding/ai-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ application:
- arm64
- amd64
- name: image-understanding-inference-app
contextdir: .
containerfile: builds/Containerfile
contextdir: app
containerfile: app/Containerfile
arch:
- arm64
- amd64
- amd64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi9/python-311:1-52
WORKDIR /image_understanding
COPY builds/requirements.txt .
COPY requirements.txt .
RUN pip install --upgrade pip && \
pip install --no-cache-dir --upgrade -r requirements.txt
COPY image_understanding.py .
Expand Down
4 changes: 2 additions & 2 deletions recipes/natural_language_processing/chatbot/ai-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ application:
- 8001
image: quay.io/ai-lab/llamacppp-python:latest
- name: streamlit-chat-app
contextdir: .
containerfile: builds/Containerfile
contextdir: app
containerfile: app/Containerfile
arch:
- arm64
- amd64
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi9/python-311:1-52
WORKDIR /chat
COPY builds/requirements.txt .
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /chat/requirements.txt
COPY chatbot_ui.py .
Expand Down
6 changes: 3 additions & 3 deletions recipes/natural_language_processing/codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ podman run --rm -it \

### Build the AI Application

Now that the Model Service is running we want to build and deploy our AI Application. Use the provided Containerfile to build the AI Application image from the `code-generation/` directory.
Now that the Model Service is running we want to build and deploy our AI Application. Use the provided Containerfile to build the AI Application image from the `codegen/` directory.

Run:

```bash
cd code-generation
podman build -t codegen . -f builds/Containerfile
cd codegen
podman build -t codegen app
```
### Deploy the AI Application

Expand Down
6 changes: 3 additions & 3 deletions recipes/natural_language_processing/codegen/ai-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: v1.0
application:
type: language
name: codegen-demo
description: This is a code-generation demo application.
description: This is a code generation demo application.
containers:
- name: llamacpp-server
contextdir: ../../../model_servers/llamacpp_python
Expand All @@ -17,8 +17,8 @@ application:
- 8001
image: quay.io/ai-lab/llamacpp-python:latest
- name: codegen-app
contextdir: .
containerfile: builds/Containerfile
contextdir: app
containerfile: app/Containerfile
arch:
- arm64
- amd64
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM registry.access.redhat.com/ubi9/python-311:1-52
WORKDIR /code-generation
COPY builds/requirements.txt .
WORKDIR /codegen
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /code-generation/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /codegen/requirements.txt
COPY codegen-app.py .
EXPOSE 8501
ENTRYPOINT ["streamlit", "run", "codegen-app.py"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Run code-generation as a systemd service
### Run codegen as a systemd service

```bash
(cd ../;make quadlet)
Expand Down
4 changes: 2 additions & 2 deletions recipes/natural_language_processing/rag/ai-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ application:
- 8000
image: quay.io/redhat-et/locallm-chromadb:latest
- name: rag-inference-app
contextdir: .
containerfile: builds/Containerfile
contextdir: app
containerfile: app/Containerfile
arch:
- arm64
- amd64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN mv /usr/local/bin/sqlite3 /usr/bin/sqlite3
ENV LD_LIBRARY_PATH="/usr/local/lib"
####
WORKDIR /rag
COPY builds/requirements.txt .
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /rag/requirements.txt
COPY rag_app.py .
Expand Down
4 changes: 2 additions & 2 deletions recipes/natural_language_processing/summarizer/ai-lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ application:
- 8001
image: quay.io/ai-lab/llamacpp-python:latest
- name: streamlit-summary-app
contextdir: .
containerfile: builds/Containerfile
contextdir: app
containerfile: app/Containerfile
arch:
- arm64
- amd64
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi9/python-311:1-52
WORKDIR /summarizer
COPY builds/requirements.txt .
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --upgrade -r /summarizer/requirements.txt
COPY summarizer.py .
Expand Down

0 comments on commit ee80b4f

Please sign in to comment.