Skip to content

Commit

Permalink
[Devtools] Add CI For Verifying/Building/Pushing Images (#15)
Browse files Browse the repository at this point in the history
* add validation ci

Signed-off-by: Jordan Dubrick <[email protected]>

* temp add branch name

Signed-off-by: Jordan Dubrick <[email protected]>

* add logic for building images

Signed-off-by: Jordan Dubrick <[email protected]>

* add explicit find for docker vs containerfile

Signed-off-by: Jordan Dubrick <[email protected]>

* change base dir to pwd

Signed-off-by: Jordan Dubrick <[email protected]>

* add push workflow

Signed-off-by: Jordan Dubrick <[email protected]>

* source env file

Signed-off-by: Jordan Dubrick <[email protected]>

* trigger on push event

Signed-off-by: Jordan Dubrick <[email protected]>

* fetch image hash

Signed-off-by: Jordan Dubrick <[email protected]>

* add github sha

Signed-off-by: Jordan Dubrick <[email protected]>

* test remove this commit

Signed-off-by: Jordan Dubrick <[email protected]>

* only reference changed directories instead of files

Signed-off-by: Jordan Dubrick <[email protected]>

* add dockerignores and env files

Signed-off-by: Jordan Dubrick <[email protected]>

* prefix image names with quay org

Signed-off-by: Jordan Dubrick <[email protected]>

* pin new action

Signed-off-by: Jordan Dubrick <[email protected]>

---------

Signed-off-by: Jordan Dubrick <[email protected]>
  • Loading branch information
Jdubrick authored Dec 6, 2024
1 parent 14ecea7 commit d82af6d
Show file tree
Hide file tree
Showing 19 changed files with 127 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/upload-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Push Images

on:
push:
branches: [ main ]

permissions: read-all

jobs:
build:
name: Push Updated Images
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

- name: Login to Quay.io
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf #v45.0.4
with:
dir_names: 'true'

- name: Push Changed Images
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
BASE_DIR=$(pwd)
for dir in ${ALL_CHANGED_FILES}; do
echo "Change detected in $dir ..."
cd $dir
if [ ! -f config.env ]; then
echo "No config.env file present in changed directory, skipping ..."
continue
fi
source config.env
echo "Running 'docker build' in $dir ..."
if [ -f "Containerfile" ]; then
docker build -t "${IMAGE_NAME}":temp -f Containerfile .
else
docker build -t "${IMAGE_NAME}":temp -f Dockerfile .
fi
docker tag "${IMAGE_NAME}":temp "${IMAGE_NAME}":"${IMAGE_TAG}" && docker push "${IMAGE_NAME}":"${IMAGE_TAG}"
docker tag "${IMAGE_NAME}":temp "${IMAGE_NAME}":"${GITHUB_SHA}" && docker push "${IMAGE_NAME}":"${GITHUB_SHA}"
cd $BASE_DIR
done
45 changes: 45 additions & 0 deletions .github/workflows/validate-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Validate Images

on:
pull_request:
branches: [ main ]

permissions: read-all

jobs:
build:
name: Validate Updated Images
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf #v45.0.4
with:
dir_names: 'true'

- name: Build Changed Images
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
BASE_DIR=$(pwd)
for dir in ${ALL_CHANGED_FILES}; do
echo "Change detected in $dir ..."
cd $dir
if [ ! -f config.env ]; then
echo "No config.env file present in changed directory, skipping ..."
continue
fi
echo "Running 'docker build' in $dir ..."
if [ -f "Containerfile" ]; then
docker build -f Containerfile .
else
docker build -f Dockerfile .
fi
cd $BASE_DIR
done
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# developer-images
Repository catalog of the Containerfiles/Dockerfiles for the developer images

When onboarding new Container/Dockerfiles please ensure a `config.env` file is present in the directory with `IMAGE_NAME` and `IMAGE_TAG` variables.
1 change: 1 addition & 0 deletions database/chroma/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions database/chroma/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/chroma
IMAGE_TAG=latest
1 change: 1 addition & 0 deletions helm-charts/application-gitops/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions helm-charts/application-gitops/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/helm-chart-application-gitops
IMAGE_TAG=latest
1 change: 1 addition & 0 deletions jupyter/minimal/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions jupyter/minimal/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/odh-minimal-notebook-container
IMAGE_TAG=latest
1 change: 1 addition & 0 deletions model/detr-resnet-101 /.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions model/detr-resnet-101 /config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/detr-resnet-101
IMAGE_TAG=latest
1 change: 1 addition & 0 deletions model/granite-7b-lab/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions model/granite-7b-lab/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/granite-7b-lab
IMAGE_TAG=latest
1 change: 1 addition & 0 deletions model/mistral-7b-code-16k-qlora/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions model/mistral-7b-code-16k-qlora/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/mistral-7b-code-16k-qlora
IMAGE_TAG=latest
1 change: 1 addition & 0 deletions model/whisper-small/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions model/whisper-small/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/whisper-small
IMAGE_TAG=latest
1 change: 1 addition & 0 deletions utils/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.env
2 changes: 2 additions & 0 deletions utils/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_NAME=quay.io/redhat-ai-dev/utils
IMAGE_TAG=latest

0 comments on commit d82af6d

Please sign in to comment.