diff --git a/.github/workflows/beta-build.yml b/.github/workflows/beta-build.yml index bdd087b6f..c9626c730 100644 --- a/.github/workflows/beta-build.yml +++ b/.github/workflows/beta-build.yml @@ -88,7 +88,7 @@ jobs: ref: ${{ github.ref }} new_version: ${{ needs.get-update-version.outputs.new_version }} runs-on: ubuntu-latest - cmake-extra-flags: "-DCORTEX_VARIANT=beta" + cmake-extra-flags: "-DCORTEX_VARIANT=prod" tags: "menloltd/cortex:${{ needs.get-update-version.outputs.new_version }}" update_release: diff --git a/.github/workflows/cortex-cpp-quality-gate.yml b/.github/workflows/cortex-cpp-quality-gate.yml index 90b394f87..5b5a2ed8c 100644 --- a/.github/workflows/cortex-cpp-quality-gate.yml +++ b/.github/workflows/cortex-cpp-quality-gate.yml @@ -101,6 +101,8 @@ jobs: run: | cd engine make run-unit-tests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run setup config for macos if: runner.os == 'macOS' diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 92b3fcef1..9a31ef5ff 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -120,7 +120,7 @@ jobs: ref: ${{ needs.set-public-provider.outputs.ref }} new_version: nightly-${{ needs.get-update-version.outputs.new_version }} runs-on: ubuntu-latest - cmake-extra-flags: "-DCORTEX_VARIANT=nightly" + cmake-extra-flags: "-DCORTEX_VARIANT=prod" tags: menloltd/cortex:nightly-${{ needs.get-update-version.outputs.new_version }} noti-discord-nightly-and-update-url-readme: diff --git a/.github/workflows/template-build-docker-x64.yml b/.github/workflows/template-build-docker-x64.yml index 22fc577c8..429397ed8 100644 --- a/.github/workflows/template-build-docker-x64.yml +++ b/.github/workflows/template-build-docker-x64.yml @@ -66,10 +66,11 @@ jobs: 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') + README_CONTENT=$(cat docker/README.md | tr -d '\r' | sed ':a;N;$!ba;s/\n/\\n/g') + JSON_PAYLOAD=$(printf '{"full_description": "%s"}' "$README_CONTENT") 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\"}" \ + -d "{\"full_description\": \"$JSON_PAYLOAD\"}" \ https://hub.docker.com/v2/repositories/menloltd/cortex/ \ No newline at end of file diff --git a/.github/workflows/test-cortexso-model-hub.yml b/.github/workflows/test-cortexso-model-hub.yml index 320369235..6e1539420 100644 --- a/.github/workflows/test-cortexso-model-hub.yml +++ b/.github/workflows/test-cortexso-model-hub.yml @@ -59,6 +59,8 @@ jobs: run: | cd engine make run-unit-tests + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run setup config for linux shell: bash diff --git a/docker/README.md b/docker/README.md index 6efaed4ee..89b5c3365 100644 --- a/docker/README.md +++ b/docker/README.md @@ -10,58 +10,56 @@ For more information on how to use Cortex, please refer to the [Cortex Documenta ### Instructions -#### Build Cortex Docker Image from source or Pull from Docker Hub +**Build Cortex Docker Image from source or Pull from Docker Hub** -##### Pull Cortex Docker Image from Docker Hub +- Pull Cortex Docker Image from Docker Hub - ```bash - # Pull the latest image - docker pull menloltd/cortex:latest +```bash +# Pull the latest image +docker pull menloltd/cortex:latest - # Pull a specific version - docker pull menloltd/cortex:nightly-1.0.1-224 - ``` +# Pull a specific version +docker pull menloltd/cortex:nightly-1.0.1-224 +``` -##### Build and Run Cortex Docker Container from Dockerfile +- Build and Run Cortex Docker Container from Dockerfile -1. Clone the Cortex repository - ```bash - git clone https://github.com/janhq/cortex.cpp.git - cd cortex.cpp - git submodule update --init - ``` -2. Build the Docker image - ```bash - # Default always uses the latest cortex.cpp and cortex.llamacpp - docker build -t cortex --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -f docker/Dockerfile . +```bash +git clone https://github.com/janhq/cortex.cpp.git +cd cortex.cpp +git submodule update --init - # Use specific version of cortex.cpp and cortex.llamacpp - docker build --build-arg CORTEX_LLAMACPP_VERSION=0.1.34 --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -t cortex -f docker/Dockerfile . - ``` +# Default always uses the latest cortex.cpp and cortex.llamacpp +docker build -t menloltd/cortex --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -f docker/Dockerfile . -#### Run Cortex Docker Container +# Use specific version of cortex.cpp and cortex.llamacpp +docker build --build-arg CORTEX_LLAMACPP_VERSION=0.1.34 --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -t menloltd/cortex -f docker/Dockerfile . +``` -1. Run the Docker container - ```bash - # Create Volume to store models and data - docker volume create cortex_data +**Run Cortex Docker Container** - # CPU mode - docker run -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 cortex +```bash +# Create Volume to store models and data +docker volume create cortex_data - # GPU mode - nvidia-docker required, it will automatically use all available GPUs - docker run --gpus all -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 cortex - ``` +# GPU mode - nvidia-docker required, it will automatically use all available GPUs +docker run --gpus all -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 menloltd/cortex -2. Check logs (Optional) - ```bash - docker logs cortex - ``` +# CPU mode +docker run -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 menloltd/cortex +``` -3. Access to http://localhost:39281 to check the cortex docs API. +**Check logs (Optional)** -4. Execute to container and try out cortex cli - ```bash - docker exec -it cortex bash - cortex --help - ``` +```bash +docker logs cortex +``` + +**Access to http://localhost:39281 to check the cortex docs API.** + +**Execute to container and try out cortex cli** + +```bash +docker exec -it cortex bash +cortex --help +``` diff --git a/engine/cli/commands/cortex_upd_cmd.cc b/engine/cli/commands/cortex_upd_cmd.cc index 1b1605866..e30271741 100644 --- a/engine/cli/commands/cortex_upd_cmd.cc +++ b/engine/cli/commands/cortex_upd_cmd.cc @@ -42,7 +42,8 @@ std::unique_ptr GetSystemInfoWithUniversal() { std::string GetNightlyInstallerName(const std::string& v, const std::string& os_arch) { const std::string kCortex = "cortex"; - std::string version = v == "latest" ? "" : (v + "-"); + // Remove 'v' in file name + std::string version = v == "latest" ? "" : (v.substr(1) + "-"); #if defined(__APPLE__) && defined(__MACH__) return kCortex + "-" + version + os_arch + "-network-installer.pkg"; #elif defined(__linux__)