2023-03-19 22:50:31 +00:00
|
|
|
---
|
|
|
|
name: 'build container images'
|
|
|
|
|
|
|
|
on:
|
2023-04-12 23:16:13 +00:00
|
|
|
pull_request:
|
2023-03-19 22:50:31 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
|
2023-05-19 06:31:11 +00:00
|
|
|
concurrency:
|
|
|
|
group: ci-${{ github.head_ref || github.ref }}-${{ github.repository }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-03-19 22:50:31 +00:00
|
|
|
jobs:
|
|
|
|
docker:
|
2023-05-31 17:51:02 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- build-type: ''
|
|
|
|
platforms: 'linux/amd64,linux/arm64'
|
|
|
|
tag-latest: 'auto'
|
|
|
|
tag-suffix: ''
|
2023-06-04 12:00:21 +00:00
|
|
|
ffmpeg: ''
|
2023-05-31 17:51:02 +00:00
|
|
|
- build-type: 'cublas'
|
|
|
|
cuda-major-version: 11
|
|
|
|
cuda-minor-version: 7
|
|
|
|
platforms: 'linux/amd64'
|
|
|
|
tag-latest: 'false'
|
|
|
|
tag-suffix: '-cublas-cuda11'
|
2023-06-04 12:00:21 +00:00
|
|
|
ffmpeg: ''
|
2023-05-31 17:51:02 +00:00
|
|
|
- build-type: 'cublas'
|
|
|
|
cuda-major-version: 12
|
|
|
|
cuda-minor-version: 1
|
|
|
|
platforms: 'linux/amd64'
|
|
|
|
tag-latest: 'false'
|
|
|
|
tag-suffix: '-cublas-cuda12'
|
2023-06-04 12:00:21 +00:00
|
|
|
ffmpeg: ''
|
|
|
|
- build-type: ''
|
|
|
|
platforms: 'linux/amd64,linux/arm64'
|
2023-06-04 19:07:12 +00:00
|
|
|
tag-latest: 'false'
|
|
|
|
tag-suffix: '-ffmpeg'
|
2023-06-04 12:00:21 +00:00
|
|
|
ffmpeg: 'true'
|
|
|
|
- build-type: 'cublas'
|
|
|
|
cuda-major-version: 11
|
|
|
|
cuda-minor-version: 7
|
|
|
|
platforms: 'linux/amd64'
|
|
|
|
tag-latest: 'false'
|
|
|
|
tag-suffix: '-cublas-cuda11-ffmpeg'
|
|
|
|
ffmpeg: 'true'
|
|
|
|
- build-type: 'cublas'
|
|
|
|
cuda-major-version: 12
|
|
|
|
cuda-minor-version: 1
|
|
|
|
platforms: 'linux/amd64'
|
|
|
|
tag-latest: 'false'
|
|
|
|
tag-suffix: '-cublas-cuda12-ffmpeg'
|
|
|
|
ffmpeg: 'true'
|
|
|
|
|
2023-03-19 22:50:31 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-07-21 20:56:43 +00:00
|
|
|
- name: Release space from worker
|
|
|
|
run: |
|
|
|
|
echo "Listing top largest packages"
|
|
|
|
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
|
|
|
|
head -n 30 <<< "${pkgs}"
|
|
|
|
echo
|
|
|
|
df -h
|
|
|
|
echo
|
|
|
|
sudo apt-get remove -y '^llvm-.*|^libllvm.*' || true
|
|
|
|
sudo apt-get remove --auto-remove android-sdk-platform-tools || true
|
|
|
|
sudo apt-get purge --auto-remove android-sdk-platform-tools || true
|
|
|
|
sudo rm -rf /usr/local/lib/android
|
|
|
|
sudo apt-get remove -y '^dotnet-.*|^aspnetcore-.*' || true
|
|
|
|
sudo rm -rf /usr/share/dotnet
|
|
|
|
sudo apt-get remove -y '^mono-.*' || true
|
|
|
|
sudo apt-get remove -y '^ghc-.*' || true
|
|
|
|
sudo apt-get remove -y '.*jdk.*|.*jre.*' || true
|
|
|
|
sudo apt-get remove -y 'php.*' || true
|
|
|
|
sudo apt-get remove -y hhvm powershell firefox monodoc-manual msbuild || true
|
|
|
|
sudo apt-get remove -y '^google-.*' || true
|
|
|
|
sudo apt-get remove -y azure-cli || true
|
|
|
|
sudo apt-get remove -y '^mongo.*-.*|^postgresql-.*|^mysql-.*|^mssql-.*' || true
|
|
|
|
sudo apt-get remove -y '^gfortran-.*' || true
|
|
|
|
sudo apt-get autoremove -y
|
|
|
|
sudo apt-get clean
|
|
|
|
echo
|
|
|
|
echo "Listing top largest packages"
|
|
|
|
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr)
|
|
|
|
head -n 30 <<< "${pkgs}"
|
|
|
|
echo
|
|
|
|
sudo rm -rfv build || true
|
|
|
|
df -h
|
2023-03-19 22:50:31 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
2023-04-12 23:13:14 +00:00
|
|
|
|
2023-05-31 17:51:02 +00:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
2023-09-14 08:40:51 +00:00
|
|
|
uses: docker/metadata-action@v5
|
2023-05-31 17:51:02 +00:00
|
|
|
with:
|
|
|
|
images: quay.io/go-skynet/local-ai
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{raw}}
|
|
|
|
type=sha
|
|
|
|
flavor: |
|
|
|
|
latest=${{ matrix.tag-latest }}
|
|
|
|
suffix=${{ matrix.tag-suffix }}
|
2023-04-12 23:13:14 +00:00
|
|
|
|
2023-03-19 22:50:31 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@master
|
|
|
|
with:
|
|
|
|
platforms: all
|
2023-04-12 23:13:14 +00:00
|
|
|
|
2023-03-19 22:50:31 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@master
|
2023-04-12 23:13:14 +00:00
|
|
|
|
2023-03-19 22:50:31 +00:00
|
|
|
- name: Login to DockerHub
|
|
|
|
if: github.event_name != 'pull_request'
|
2023-09-13 07:17:50 +00:00
|
|
|
uses: docker/login-action@v3
|
2023-03-19 22:50:31 +00:00
|
|
|
with:
|
|
|
|
registry: quay.io
|
2023-05-02 18:03:35 +00:00
|
|
|
username: ${{ secrets.LOCALAI_REGISTRY_USERNAME }}
|
|
|
|
password: ${{ secrets.LOCALAI_REGISTRY_PASSWORD }}
|
2023-05-31 17:51:02 +00:00
|
|
|
|
|
|
|
- name: Build and push
|
2023-09-13 07:17:28 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2023-04-12 23:13:14 +00:00
|
|
|
with:
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
2023-05-31 17:51:02 +00:00
|
|
|
build-args: |
|
|
|
|
BUILD_TYPE=${{ matrix.build-type }}
|
|
|
|
CUDA_MAJOR_VERSION=${{ matrix.cuda-major-version }}
|
|
|
|
CUDA_MINOR_VERSION=${{ matrix.cuda-minor-version }}
|
2023-06-04 12:00:21 +00:00
|
|
|
FFMPEG=${{ matrix.ffmpeg }}
|
2023-04-12 23:13:14 +00:00
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
2023-05-31 17:51:02 +00:00
|
|
|
platforms: ${{ matrix.platforms }}
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|