From 44f74671cbe1b1d2d33159682441f175546aa351 Mon Sep 17 00:00:00 2001 From: Bernat Vadell Date: Wed, 15 Mar 2023 17:45:33 +0100 Subject: [PATCH] add docker action pipeline --- .devops/{tools.Dockerfile => full.Dockerfile} | 0 .devops/tools.sh | 11 ++-- .github/workflows/docker.yml | 50 +++++++++++++++++++ 3 files changed, 58 insertions(+), 3 deletions(-) rename .devops/{tools.Dockerfile => full.Dockerfile} (100%) create mode 100644 .github/workflows/docker.yml diff --git a/.devops/tools.Dockerfile b/.devops/full.Dockerfile similarity index 100% rename from .devops/tools.Dockerfile rename to .devops/full.Dockerfile diff --git a/.devops/tools.sh b/.devops/tools.sh index ca32e4503..35d22992e 100755 --- a/.devops/tools.sh +++ b/.devops/tools.sh @@ -11,9 +11,14 @@ arg2="$@" if [[ $arg1 == '--convert' || $arg1 == '-c' ]]; then python3 ./convert-pth-to-ggml.py $arg2 -elif [[ $arg1 == '--quantize' || $arg1 == '-q' ]]; then +elif [[ $arg1 == '--quantize' || $arg1 == '-q' ]]; then /app/quantize $arg2 +elif [[ $arg1 == '--run' || $arg1 == '-r' ]]; then + /app/main $arg2 else echo "Unknown command: $arg1" - echo "Valid commands: --convert (-c) or --quantize (-q)" -fi \ No newline at end of file + echo "Available commands: " + echo " --run (-r)" + echo " --convert (-c)" + echo " --quantize (-q)" +fi diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..4e20453a2 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,50 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Publish Docker image + +on: + push: + branches: + - master + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + + strategy: + matrix: + config: + - { tag: "latest", dockerfile: ".devops/main.Dockerfile" } + - { tag: "full", dockerfile: ".devops/full.Dockerfile" } + + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: "bernatvadell/llamacpp:${{ matrix.config.tag }}" + file: ${{ matrix.config.dockerfile }}