From 054fd752417c10fc528d29452b084f6fafe2f3ef Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 6 Nov 2024 16:50:58 +0700 Subject: [PATCH] fix: macos updater --- .github/workflows/nightly-build.yml | 4 ++-- .github/workflows/template-build-docker-x64.yml | 15 ++++++++++++++- .github/workflows/template-noti-discord.yaml | 1 + docker/README.md | 11 +++++++++++ engine/cli/commands/cortex_upd_cmd.cc | 4 ++-- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 867b32b72..92b3fcef1 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -124,7 +124,7 @@ jobs: tags: menloltd/cortex:nightly-${{ needs.get-update-version.outputs.new_version }} noti-discord-nightly-and-update-url-readme: - needs: [build-macos, build-windows-x64, build-linux-x64, get-update-version, set-public-provider, get-cortex-llamacpp-latest-version, update-latest-version] + needs: [build-macos, build-windows-x64, build-linux-x64, get-update-version, set-public-provider, get-cortex-llamacpp-latest-version, update-latest-version, build-docker-x64] secrets: inherit if: github.event_name == 'schedule' uses: ./.github/workflows/template-noti-discord.yaml @@ -133,7 +133,7 @@ jobs: new_version: ${{ needs.get-update-version.outputs.new_version }} noti-discord-manual: - needs: [build-macos, build-windows-x64, build-linux-x64, get-update-version, set-public-provider, get-cortex-llamacpp-latest-version] + needs: [build-macos, build-windows-x64, build-linux-x64, get-update-version, set-public-provider, get-cortex-llamacpp-latest-version, build-docker-x64] secrets: inherit if: github.event_name == 'workflow_dispatch' && github.event.inputs.public_provider == 'aws-s3' uses: ./.github/workflows/template-noti-discord.yaml diff --git a/.github/workflows/template-build-docker-x64.yml b/.github/workflows/template-build-docker-x64.yml index fa611e6d9..22fc577c8 100644 --- a/.github/workflows/template-build-docker-x64.yml +++ b/.github/workflows/template-build-docker-x64.yml @@ -59,4 +59,17 @@ jobs: tags: ${{ inputs.tags }} build-args: | CORTEX_CPP_VERSION=${{ inputs.new_version }} - CMAKE_EXTRA_FLAGS=${{ inputs.cmake-extra-flags }} \ No newline at end of file + CMAKE_EXTRA_FLAGS=${{ inputs.cmake-extra-flags }} + + - name: Update Docker Hub overview + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + run: | + README_CONTENT=$(cat docker/README.md | tr -d '\r' | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g') + + curl -X PATCH \ + -H "Content-Type: application/json" \ + -H "Authorization: JWT $(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'"$DOCKERHUB_USERNAME"'", "password": "'"$DOCKERHUB_TOKEN"'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)" \ + -d "{\"full_description\": \"$README_CONTENT\"}" \ + https://hub.docker.com/v2/repositories/menloltd/cortex/ \ No newline at end of file diff --git a/.github/workflows/template-noti-discord.yaml b/.github/workflows/template-noti-discord.yaml index 3752a2201..246f3abcb 100644 --- a/.github/workflows/template-noti-discord.yaml +++ b/.github/workflows/template-noti-discord.yaml @@ -42,4 +42,5 @@ jobs: - Network Installer: https://delta.jan.ai/cortex/v${{ env.VERSION }}/linux-amd64/cortex-${{ env.VERSION }}-linux-amd64-network-installer.deb - Local Installer: https://delta.jan.ai/cortex/v${{ env.VERSION }}/linux-amd64/cortex-${{ env.VERSION }}-linux-amd64-local-installer.deb - Binary: https://delta.jan.ai/cortex/v${{ env.VERSION }}/linux-amd64/cortex-nightly.tar.gz + - Docker: menloltd/cortex:${{ env.VERSION }} - Github action run: https://github.com/janhq/cortex.cpp/actions/runs/${{ env.RUNNER_ID }} diff --git a/docker/README.md b/docker/README.md index a89686b1e..f2720bd00 100644 --- a/docker/README.md +++ b/docker/README.md @@ -7,6 +7,17 @@ This guide will help you set up and run Cortex using Docker. - nvidia-container-toolkit (for GPU support) ### Instructions + +#### Pull Cortex Docker Image from Docker Hub +1. Pull the Cortex Docker image from Docker Hub + ```bash + # Pull the latest image + docker pull menloltd/cortex:latest + + docker pull menloltd/cortex:1.0.1-224 + ``` + +#### Build and Run Cortex Docker Container from Dockerfile 1. Clone the Cortex repository ```bash git clone https://github.com/janhq/cortex.cpp.git diff --git a/engine/cli/commands/cortex_upd_cmd.cc b/engine/cli/commands/cortex_upd_cmd.cc index 61fc6076f..1b1605866 100644 --- a/engine/cli/commands/cortex_upd_cmd.cc +++ b/engine/cli/commands/cortex_upd_cmd.cc @@ -55,10 +55,10 @@ std::string GetNightlyInstallerName(const std::string& v, // C:\Users\vansa\AppData\Local\Temp\cortex\cortex-windows-amd64-network-installer.exe std::string GetInstallCmd(const std::string& exe_path) { #if defined(__APPLE__) && defined(__MACH__) - return "sudo touch /var/tmp/cortex_installer_skip_postinstall && sudo installer " + return "sudo touch /var/tmp/cortex_installer_skip_postinstall_check && sudo installer " "-pkg " + exe_path + - " -target / && sudo rm /var/tmp/cortex_installer_skip_postinstall"; + " -target / && sudo rm /var/tmp/cortex_installer_skip_postinstall_check"; #elif defined(__linux__) return "echo -e \"n\\n\" | sudo SKIP_POSTINSTALL=true apt install -y " "--allow-downgrades " +