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

118 lines
4.0 KiB
YAML
Raw Normal View History

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