diff --git a/.github/workflows/build-commit.yml b/.github/workflows/build-commit.yml index 809823a..7caa695 100644 --- a/.github/workflows/build-commit.yml +++ b/.github/workflows/build-commit.yml @@ -25,7 +25,6 @@ jobs: - name: Dependencies id: depends run: | - brew update brew install cmake boost asio - name: Build id: make_build diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 3c6b7a2..3a3d85f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -16,9 +16,52 @@ jobs: strategy: matrix: config: - - {tag: "", dockerfile: "./Dockerfile.default", platforms: "linux/amd64,linux/arm64"} - - {tag: "-cuda11", dockerfile: "./Dockerfile.cuda11", platforms: "linux/amd64"} - - {tag: "-cuda12", dockerfile: "./Dockerfile.cuda12", platforms: "linux/amd64"} + - 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: @@ -45,7 +88,7 @@ jobs: password: ${{ secrets.GH_TOKEN }} - name: Build and push incremental - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v4.1.1 if: (!startsWith(github.ref, 'refs/tags/')) with: file: ${{matrix.config.dockerfile}} @@ -53,6 +96,12 @@ jobs: 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) @@ -64,6 +113,11 @@ jobs: 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}}" - name: Build and push release (Accelerated Builds) @@ -75,3 +129,8 @@ jobs: 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}}" diff --git a/Dockerfile.cuda11 b/Dockerfile.cuda11 deleted file mode 100644 index bbeeff3..0000000 --- a/Dockerfile.cuda11 +++ /dev/null @@ -1,39 +0,0 @@ -FROM nvidia/cuda:11.7.1-devel-ubuntu22.04 AS build - -ENV DEBIAN_FRONTEND=noninteractive - -# inlude kitware apt repo to allow us to grab latest cmake -RUN apt-get update && apt-get install ca-certificates gpg wget -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null -RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null - -RUN apt-get update && apt-get install -y build-essential cmake libboost-dev libboost-thread-dev - - -ADD ./ /turbopilot - -RUN mkdir /turbopilot/build - -WORKDIR /turbopilot/build - -RUN cmake -DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. -RUN make turbopilot - -FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04 AS runtime - - -WORKDIR /app - -COPY --from=build /turbopilot/build/bin/turbopilot /app/turbopilot - -ENV THREADS=4 - -ENV MODEL="/models/codegen-2B-multi-ggml-4bit-quant.bin" - -ENV BATCHSIZE=64 - -COPY ./run.sh /app/ - -EXPOSE 18080 - -CMD /app/run.sh \ No newline at end of file diff --git a/Dockerfile.cuda12 b/Dockerfile.cuda12 deleted file mode 100644 index ff27869..0000000 --- a/Dockerfile.cuda12 +++ /dev/null @@ -1,37 +0,0 @@ -FROM nvidia/cuda:12.2.0-devel-ubuntu20.04 AS build - -ENV DEBIAN_FRONTEND=noninteractive - -# inlude kitware apt repo to allow us to grab latest cmake -RUN apt-get update && apt-get install ca-certificates gpg wget -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null -RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null - -RUN apt-get update && apt-get install -y build-essential cmake libboost-dev libboost-thread-dev - -ADD ./ /turbopilot - -RUN mkdir /turbopilot/build - -WORKDIR /turbopilot/build - -RUN cmake -DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. -RUN make turbopilot - -FROM nvidia/cuda:12.2.0-runtime-ubuntu20.04 AS runtime - -WORKDIR /app - -COPY --from=build /turbopilot/build/bin/turbopilot /app/turbopilot - -ENV THREADS=4 - -ENV MODEL="/models/codegen-2B-multi-ggml-4bit-quant.bin" - -ENV BATCHSIZE=64 - -COPY ./run.sh /app/ - -EXPOSE 18080 - -CMD /app/run.sh diff --git a/Dockerfile.default b/Dockerfile.default index 54b39e7..caaeb68 100644 --- a/Dockerfile.default +++ b/Dockerfile.default @@ -1,4 +1,13 @@ -FROM ubuntu:22.04 AS build +ARG BUILD_BASE="ubuntu:22.04" +ARG RUNTIME_BASE="ubuntu:22.04" + +FROM ${BUILD_BASE} AS build + +ARG EXTRA_DEPS="" +ARG CMAKE_ARGS="" + +RUN echo "CMAKE_ARGS: ${CMAKE_ARGS}" +RUN echo "EXTRA_DEPS: ${EXTRA_DEPS}" ENV DEBIAN_FRONTEND=noninteractive @@ -7,7 +16,7 @@ RUN apt-get update && apt-get install -y ca-certificates gpg wget RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null -RUN apt-get update && apt-get install -y build-essential cmake libboost-dev libboost-thread-dev +RUN apt-get update && apt-get install -y build-essential cmake libboost-dev libboost-thread-dev ${EXTRA_DEPS} ADD ./ /turbopilot @@ -15,10 +24,14 @@ RUN mkdir /turbopilot/build WORKDIR /turbopilot/build -RUN cmake .. +RUN cmake .. ${CMAKE_ARGS} RUN make turbopilot -FROM ubuntu:22.04 AS runtime +FROM ${RUNTIME_BASE} AS runtime + +ARG RUNTIME_DEPS="" + +RUN if [[ -z "${RUNTIME_DEPS}" ]] ; then echo "No runtime libs required" ; else apt-get update && apt-get install -y ${RUNTIME_DEPS} ; fi WORKDIR /app