diff --git a/docker/Dockerfile b/docker/Dockerfile index 315dcd4e0..98a87b1e1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,6 +2,8 @@ FROM ubuntu:22.04 as base FROM base as build +ARG CORTEX_CPP_VERSION=latest + ENV DEBIAN_FRONTEND=noninteractive # Install dependencies @@ -41,9 +43,11 @@ RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/nul WORKDIR /app -COPY . /app/ +COPY ./engine /app/engine + +COPY ./docs/static/openapi/cortex.json /app/docs/static/openapi/cortex.json -RUN git submodule update --init && cd engine && make configure-vcpkg && make build CMAKE_EXTRA_FLAGS="-DCORTEX_CPP_VERSION=$(git rev-parse HEAD) -DCMAKE_BUILD_TEST=OFF -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake" +RUN cd engine && make configure-vcpkg && make build CMAKE_EXTRA_FLAGS="-DCORTEX_CPP_VERSION=${CORTEX_CPP_VERSION} -DCMAKE_BUILD_TEST=OFF -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake" FROM base as runtime @@ -74,6 +78,8 @@ RUN chmod +x /tmp/download-cortex.llamacpp.sh && /bin/bash /tmp/download-cortex. # Copy the entrypoint script COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + EXPOSE 39281 HEALTHCHECK --interval=300s --timeout=30s --start-period=10s --retries=3 \ diff --git a/docker/README.md b/docker/README.md index bdc917013..a89686b1e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -10,16 +10,16 @@ This guide will help you set up and run Cortex using Docker. 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 -f docker/Dockerfile . + docker build -t cortex --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -f docker/Dockerfile . # Use specific version of cortex.cpp and cortex.llamacpp - docker build --build-arg CORTEX_LLAMACPP_VERSION=0.1.34 -t cortex -f docker/Dockerfile . + docker build --build-arg CORTEX_LLAMACPP_VERSION=0.1.34 --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -t cortex -f docker/Dockerfile . ``` 3. Run the Docker container