Fix Ilab container builds #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Instructlab image builds | ||
on: | ||
schedule: # schedule the job to run at 12 AM daily | ||
- cron: '0 0 * * *' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/instructlab.yaml | ||
- training/instructlab/Makefile | ||
# push: | ||
# branches: | ||
# - main | ||
# paths: | ||
# - .github/workflows/instructlab.yaml | ||
# - training/instructlab/Makefile | ||
workflow_dispatch: | ||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
env: | ||
REGISTRY: ghcr.io | ||
REGISTRY_ORG: containers | ||
jobs: | ||
instructlab-image-builds: | ||
# if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests') && github.repository == 'containers-mirror/ai-lab-recipes'" | ||
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')" | ||
strategy: | ||
matrix: | ||
include: | ||
# - make_target: nvidia | ||
# containerfile_path: training/instructlab/instructlab/containers/cuda/Containerfile | ||
- make_target: amd | ||
containerfile_path: instructlab/containers/rocm/Containerfile | ||
- make_target: intel | ||
containerfile_path: instructlab/containers/hpu/Containerfile | ||
runs-on: ubuntu-latest | ||
# runs-on: ubuntu-22.04-2core # starting with minimal option | ||
steps: | ||
- name: Remove unnecessary files | ||
run: | | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
- uses: actions/[email protected] | ||
- uses: docker/setup-buildx-action@v3 | ||
- name: Login to Container Registry | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
docker login ${{ env.REGISTRY }} -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_PASSWORD }} | ||
- name: Extract metadata (tags, labels) for gotbot image | ||
id: ilab_meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/instructlab-${{ matrix.make_target }} | ||
- name: Make Instructlab | ||
run: make instructlab | ||
working-directory: ./training/instructlab | ||
- name: Build and push ilab images | ||
uses: docker/build-push-action@v5 | ||
working-directory: ./training/instructlab | ||
with: | ||
context: instructlab | ||
platforms: linux/amd64 | ||
build-args: | | ||
GIT_TAG=stable | ||
push: false | ||
tags: ${{ steps.ilab_meta.outputs.tags }} | ||
labels: ${{ steps.ilab_meta.outputs.labels }} | ||
# cache-from: type=gha | ||
# cache-to: type=gha,mode=max | ||
file: ${{ matrix.containerfile_path }} | ||
- name: Build Image | ||
id: build_image | ||
working-directory: ./training/instructlab | ||
run: | | ||
buildah --version | ||
buildah bud --platform linux/amd64 \ | ||
-f ${{ matrix.containerfile_path }} \ | ||
--format docker \ | ||
--tls-verify=true \ | ||
-t ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/instructlab-${{ matrix.make_target}}:latest \ | ||
instructlab/ | ||
- name: Publish Job Results to Slack | ||
id: slack | ||
if: always() | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |