turbopilot/.github/workflows/docker-image.yml
2023-08-26 17:01:35 +01:00

139 lines
4.6 KiB
YAML

name: Docker Image CI
on:
push:
branches: [ '**' ]
tags: ['*']
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
config:
- tag:
dockerfile: ./Dockerfile.default
platforms: linux/amd64,linux/arm64
build_base: ubuntu:22.04
runtime_base: ubuntu:22.04
- tag: -openblas
dockerfile: ./Dockerfile.default
platforms: linux/amd64,linux/arm64
build_base: ubuntu:22.04
runtime_base: ubuntu:22.04
extra_deps: libopenblas-dev
cmake_args: -DGGML_OPENBLAS=On
- tag: -cuda11-7
dockerfile: ./Dockerfile.default
platforms: linux/amd64
build_base: nvidia/cuda:11.7.1-devel-ubuntu22.04
runtime_base: nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04
cmake_args: -DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc
- tag: -cuda12-0
dockerfile: ./Dockerfile.default
platforms: linux/amd64
build_base: nvidia/cuda:12.0.0-devel-ubuntu22.04
runtime_base: nvidia/cuda:12.0.0-runtime-ubuntu22.04
cmake_args: -DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc
- tag: -cuda12-2
dockerfile: ./Dockerfile.default
platforms: linux/amd64
build_base: nvidia/cuda:12.2.0-devel-ubuntu22.04
runtime_base: nvidia/cuda:12.2.0-runtime-ubuntu22.04
cmake_args: -DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc
# - tag: -clblast
# dockerfile: ./Dockerfile.default
# platforms: linux/amd64
# build_base: ubuntu:22.04
# runtime_base: ubuntu:22.04
# runtime_deps: libclblast1
# extra_deps: libclblast-dev
# cmake_args: -DGGML_CLBLAST=On
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm68/v8
- name: Login to GH ContainerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ravenscroftj
password: ${{ secrets.GH_TOKEN }}
- name: Build and push incremental
uses: docker/build-push-action@v4.1.1
if: (!startsWith(github.ref, 'refs/tags/'))
with:
file: ${{matrix.config.dockerfile}}
push: true
tags: ghcr.io/ravenscroftj/turbopilot:nightly${{matrix.config.tag}}-${{ github.sha }}
context: ${{github.workspace}}
platforms: ${{matrix.config.platforms}}
build-args: |
EXTRA_DEPS=${{matrix.config.extra_deps}}
CMAKE_ARGS=${{matrix.config.cmake_args}}
BUILD_BASE=${{matrix.config.build_base}}
RUNTIME_BASE=${{matrix.config.runtime_base}}
RUNTIME_DEPS=${{matrix.config.runtime_deps}}
- name: Build and push release (Main Latest Build)
uses: docker/build-push-action@v4
if: startsWith(github.ref, 'refs/tags/') && matrix.config.tag == ''
with:
file: ${{matrix.config.dockerfile}}
push: true
tags: ghcr.io/ravenscroftj/turbopilot:${{ github.ref_name }}, ghcr.io/ravenscroftj/turbopilot:latest
context: ${{github.workspace}}
platforms: ${{matrix.config.platforms}}
build-args: |
EXTRA_DEPS=${{matrix.config.extra_deps}}
CMAKE_ARGS=${{matrix.config.cmake_args}}
BUILD_BASE=${{matrix.config.build_base}}
RUNTIME_BASE=${{matrix.config.runtime_base}}
RUNTIME_DEPS=${{matrix.config.runtime_deps}}
- name: Build and push release (Accelerated Builds)
uses: docker/build-push-action@v4
if: startsWith(github.ref, 'refs/tags/') && matrix.config.tag != ''
with:
file: ${{matrix.config.dockerfile}}
push: true
tags: ghcr.io/ravenscroftj/turbopilot:${{ github.ref_name }}${{matrix.config.tag}}
context: ${{github.workspace}}
platforms: ${{matrix.config.platforms}}
build-args: |
EXTRA_DEPS=${{matrix.config.extra_deps}}
CMAKE_ARGS=${{matrix.config.cmake_args}}
BUILD_BASE=${{matrix.config.build_base}}
RUNTIME_BASE=${{matrix.config.runtime_base}}
RUNTIME_DEPS=${{matrix.config.runtime_deps}}