turbopilot/.github/workflows/docker-image.yml

127 lines
4.1 KiB
YAML
Raw Normal View History

2023-04-10 04:02:57 -04:00
name: Docker Image CI
on:
push:
2023-05-08 09:55:33 -04:00
branches: [ '**' ]
2023-04-14 03:39:03 -04:00
tags: ['*']
2023-04-10 04:02:57 -04:00
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
2023-05-08 06:38:25 -04:00
strategy:
matrix:
config:
2023-08-26 08:22:09 -04:00
- tag: ""
dockerfile: "./Dockerfile.default"
platforms: "linux/amd64,linux/arm64"
2023-08-26 08:28:08 -04:00
build_base: "ubuntu:22.04"
runtime_base: "ubuntu:22.04"
2023-08-26 08:22:09 -04:00
- tag: "-openblas"
dockerfile: "./Dockerfile.default"
platforms: "linux/amd64,linux/arm64"
2023-08-26 08:28:08 -04:00
build_base: "ubuntu:22.04"
runtime_base: "ubuntu:22.04"
extra_deps: "libopenblas-dev"
cmake_args: "-DGGML_OPENBLAS=On"
2023-08-26 08:22:09 -04:00
2023-08-26 08:28:08 -04:00
- tag: "-cuda11-7"
2023-08-26 08:22:09 -04:00
dockerfile: "./Dockerfile.default"
platforms: "linux/amd64"
2023-08-26 08:28:08 -04:00
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"
2023-08-26 08:22:09 -04:00
- tag: "-cuda12-0"
dockerfile: "./Dockerfile.default"
platforms: "linux/amd64"
2023-08-26 08:32:01 -04:00
build_base: "nvidia/cuda:12.0.0-devel-ubuntu22.04"
runtime_base: "nvidia/cuda:12.0.0-runtime-ubuntu22.04"
2023-08-26 08:28:08 -04:00
cmake_args: "-DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc"
2023-08-26 08:22:09 -04:00
- tag: "-cuda12-2"
dockerfile: "./Dockerfile.default"
platforms: "linux/amd64"
2023-08-26 08:32:01 -04:00
build_base: "nvidia/cuda:12.2.0-devel-ubuntu22.04"
runtime_base: "nvidia/cuda:12.2.0-runtime-ubuntu22.04"
2023-08-26 08:28:08 -04:00
cmake_args: "-DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc"
2023-08-26 08:22:09 -04:00
- tag: "-clblast"
dockerfile: "./Dockerfile.default"
platforms: "linux/amd64"
2023-08-26 08:28:08 -04:00
build_base: "ubuntu:22.04"
runtime_base: "ubuntu:22.04"
extra_deps: libclblast-dev
cmake_args: DGGML_CLBLAST=On
2023-08-26 08:22:09 -04:00
2023-05-08 06:38:25 -04:00
2023-04-10 04:02:57 -04:00
steps:
2023-04-10 04:05:55 -04:00
- name: Checkout
2023-04-13 03:20:26 -04:00
uses: actions/checkout@v3
2023-04-10 04:09:10 -04:00
with:
submodules: true
2023-04-10 04:07:53 -04:00
2023-04-13 03:16:35 -04:00
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
2023-04-13 03:20:26 -04:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
2023-04-13 03:16:35 -04:00
2023-04-13 03:20:26 -04:00
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with:
2023-04-14 01:53:16 -04:00
platforms: linux/amd64,linux/arm64,linux/arm68/v8
2023-04-13 03:16:35 -04:00
- name: Login to GH ContainerHub
uses: docker/login-action@v2
2023-04-10 04:02:57 -04:00
with:
2023-04-13 03:16:35 -04:00
registry: ghcr.io
username: ravenscroftj
password: ${{ secrets.GH_TOKEN }}
2023-04-14 03:34:10 -04:00
- name: Build and push incremental
2023-08-26 07:57:00 -04:00
uses: docker/build-push-action@v4.1.1
2023-04-14 03:34:10 -04:00
if: (!startsWith(github.ref, 'refs/tags/'))
2023-04-13 03:16:35 -04:00
with:
2023-05-08 06:41:44 -04:00
file: ${{matrix.config.dockerfile}}
2023-04-13 03:16:35 -04:00
push: true
2023-05-08 07:52:43 -04:00
tags: ghcr.io/ravenscroftj/turbopilot:nightly${{matrix.config.tag}}-${{ github.sha }}
2023-04-14 03:34:10 -04:00
context: ${{github.workspace}}
2023-08-04 17:32:48 -04:00
platforms: ${{matrix.config.platforms}}
2023-08-26 08:28:08 -04:00
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}}
2023-08-26 07:43:52 -04:00
2023-04-14 03:34:10 -04:00
2023-08-05 03:01:40 -04:00
- name: Build and push release (Main Latest Build)
2023-04-14 03:34:10 -04:00
uses: docker/build-push-action@v4
2023-05-08 06:39:46 -04:00
if: startsWith(github.ref, 'refs/tags/') && matrix.config.tag == ''
2023-04-14 03:34:10 -04:00
with:
2023-05-08 06:41:44 -04:00
file: ${{matrix.config.dockerfile}}
2023-04-14 03:34:10 -04:00
push: true
tags: ghcr.io/ravenscroftj/turbopilot:${{ github.ref_name }}, ghcr.io/ravenscroftj/turbopilot:latest
2023-04-13 03:22:35 -04:00
context: ${{github.workspace}}
2023-08-04 17:32:48 -04:00
platforms: ${{matrix.config.platforms}}
2023-08-26 07:43:52 -04:00
build-args: ${{matrix.config.build_args}}
2023-05-08 06:38:25 -04:00
2023-08-05 03:01:40 -04:00
- name: Build and push release (Accelerated Builds)
2023-05-08 06:38:25 -04:00
uses: docker/build-push-action@v4
2023-05-08 06:39:46 -04:00
if: startsWith(github.ref, 'refs/tags/') && matrix.config.tag != ''
2023-05-08 06:38:25 -04:00
with:
2023-05-08 06:41:44 -04:00
file: ${{matrix.config.dockerfile}}
2023-05-08 06:38:25 -04:00
push: true
2023-08-05 03:01:40 -04:00
tags: ghcr.io/ravenscroftj/turbopilot:${{ github.ref_name }}${{matrix.config.tag}}
2023-05-08 06:38:25 -04:00
context: ${{github.workspace}}
platforms: ${{matrix.config.platforms}}
2023-08-26 07:43:52 -04:00
build-args: ${{matrix.config.build_args}}