Skip to content

Update github-actions-build-all.yml #220

Update github-actions-build-all.yml

Update github-actions-build-all.yml #220

name: Build & publish all recipe images
on:
[push]
# release:
# types: [published]
env:
REGISTRY: ghcr.io
jobs:
truss-recipe:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- recipe-name: gpt2
version: "0.1"
- recipe-name: bert-base-uncased
version: "0.2"
- recipe-name: whisper-medium
version: "0.2"
- recipe-name: clip-vit-large-patch14
version: "0.2"
- recipe-name: t5-base
version: "0.2"
- recipe-name: toxic-comment-model
version: "0.2"
- recipe-name: vit-age-classifier
version: "0.2"
- recipe-name: wav2vec2-large-xlsr-53-english
version: "0.2"
- recipe-name: bart-large-cnn
version: "0.2"
- recipe-name: parrot_adequacy_model
version: "0.2"
- recipe-name: roberta-base-squad2
version: "0.2"
- recipe-name: twitter-roberta-base-sentiment
version: "0.2"
- recipe-name: vit-gpt2-image-captioning
version: "0.2"
- recipe-name: roberta-base
version: "0.2"
- recipe-name: twitter-roberta-base-sentiment
version: "0.2"
- recipe-name: bloom-560m
version: "0.1"
- recipe-name: falcon-7b-instruct
version: "0.2"
permissions:
contents: read
packages: write
actions: write
steps:
# Check if the package already exists for this version and skip the build if it does
- name: Check for changes
id: check_new
run: |
tags=$(curl -L \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
https://api.github.com/orgs/saladtechnologies/packages/container/recipe-${{ matrix.recipe-name }}/versions | jq -r 'try(.[0].metadata.container.tags | any(. == "${{ matrix.version }}") ) catch "false"')
echo $tags
# Checks to see if the specified version already exists in the packages versions
if [ "$tags" == "false" ]; then
echo "IS_NEW=true" >> $GITHUB_OUTPUT
echo "It is new!!!"
else
echo "IS_NEW=false" >> $GITHUB_OUTPUT
echo "This tag already exists."
fi
# Check out the repo
- name: Checkout repository
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: actions/checkout@v2
# Log into GHCR
- name: Log in to the Container registry
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Setup Python (faster than using Python container)
- name: Setup Python
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: actions/setup-python@v2
with:
python-version: "3.9"
# Install Truss
- name: Install Truss
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
run: |
python -m pip install truss
# Build truss container context
- name: Build Truss docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
run: truss build-context ./src/${{ matrix.recipe-name }}/out ./src/${{ matrix.recipe-name }}
# Add socat and startup script to Docker image for IPv6 tunneling
- name: Add socat to Docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
run: |
echo '#!/bin/bash' > ./src/${{ matrix.recipe-name }}/out/server/start.sh
echo "echo 'socat TCP6-LISTEN:8888,fork TCP4:127.0.0.1:8080 &'" >> ./src/${{ matrix.recipe-name }}/out/server/start.sh
echo 'socat TCP6-LISTEN:8888,fork TCP4:127.0.0.1:8080 &' >> ./src/${{ matrix.recipe-name }}/out/server/start.sh
echo 'python3 /app/inference_server.py' >> ./src/${{ matrix.recipe-name }}/out/server/start.sh
chmod +x ./src/${{ matrix.recipe-name }}/out/server/start.sh
sed -i -r ':a; /^\s*$/ {N;ba}; s/( *\n *){2,}/\n\n/' ./src/${{ matrix.recipe-name }}/out/Dockerfile
sed -i '/COPY .\/server_requirements.txt.*/i # Salad Recipes require IPv6 tunnels\nRUN apt update\nRUN apt install -y socat\n' ./src/${{ matrix.recipe-name }}/out/Dockerfile
sed -i 's/^\(CMD exec python3 \/app.*\)/# \1\n\nCMD bash start.sh/' ./src/${{ matrix.recipe-name }}/out/Dockerfile
# Get meta data
- name: Extract metadata (tags, labels) for Docker
id: meta
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
# Create and push image
- name: Build and push Docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./src/${{ matrix.recipe-name }}/out
push: true
tags: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
labels: ${{ steps.meta.outputs.labels }}
docker-recipe:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- recipe-name: anything4.0
version: "0.4"
- recipe-name: openjourney4
version: "0.4"
- recipe-name: stable-diffusion-1.5
version: "0.3"
- recipe-name: stable-diffusion-2.1
version: "0.3"
- recipe-name: stable-diffusion-1.4
version: "0.3"
- recipe-name: falcon-7b-instruct-docker
version: "0.1"
- recipe-name: gpt-j-6b-test
version: "0.2"
- recipe-name: whisper
version: "0.1"
- recipe-name: llama-7b
version: "0.3"
- recipe-name: gfp-gan
version: "0.1"
- recipe-name: musicgen-large
version: "0.1"
- recipe-name: dolly-v2
version: "0.3"
- recipe-name: dolly-v2-docker
version: "0.1"
- recipe-name: alpaca-7b-recipe
version: '0.2'
#- recipe-name: pygmalion-6b
#version: '0.1'
- recipe-name: mpt-7b-base
version: '0.1'
- recipe-name: mpt-7b-storywriter
version: '0.1'
- recipe-name: mpt-7b-chat
version: '0.1'
- recipe-name: mpt-7b-instruct
version: '0.1'
- recipe-name: wizardlm
version: '0.1'
- recipe-name: dolly-v2-7b
version: "0.1"
- recipe-name: stablelm-base-3b
version: "0.1"
- recipe-name: stablelm-tuned-3b
version: "0.1"
- recipe-name: replit-code-1.3b
version: "0.1"
- recipe-name: layoutlm
version: "0.1"
#- recipe-name: sdxl
#version: "0.1"
- recipe-name: nsql
version: "0.1"
- recipe-name: code-llama-7b
version: "0.1"
- recipe-name: code-llama-python-7b
version: "0.1"
- recipe-name: code-llama-instruct-7b
version: "0.1"
- recipe-name: base-ubuntu
version: "0.1"
- recipe-name: example-image
version: "0.1"
permissions:
contents: read
packages: write
actions: write
steps:
# Check if the package already exists for this version and skip the build if it does
- name: Check for changes
id: check_new
run: |
tags=$(curl -L \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
https://api.github.com/orgs/saladtechnologies/packages/container/recipe-${{ matrix.recipe-name }}/versions | jq -r 'try(.[0].metadata.container.tags | any(. == "${{ matrix.version }}") ) catch "false"')
echo $tags
# Checks to see if the specified version already exists in the packages versions
if [ "$tags" == "false" ]; then
echo "IS_NEW=true" >> $GITHUB_OUTPUT
echo "It is new!!!"
else
echo "IS_NEW=false" >> $GITHUB_OUTPUT
echo "This tag already exists."
fi
# Check out the repo
- name: Checkout repository
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: actions/checkout@v2
# Log into GHCR
- name: Log in to the Container registry
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Get meta data
- name: Extract metadata (tags, labels) for Docker
id: meta
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
# Create and push image
- name: Build and push Docker image
if: ${{ steps.check_new.outputs.IS_NEW == 'true' }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./src/${{ matrix.recipe-name }}
file: ./src/${{ matrix.recipe-name }}/Dockerfile
push: true
tags: ghcr.io/saladtechnologies/recipe-${{ matrix.recipe-name }}:${{ matrix.version }}
labels: ${{ steps.meta.outputs.labels }}