Skip to content

Commit 6dc31cb

Browse files
committed
chores: fix dockerfile
1 parent 332ac36 commit 6dc31cb

File tree

4 files changed

+30
-42
lines changed

4 files changed

+30
-42
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
* Features
88
* `instinct-transformer`: New bge-m3 embedding model. Generally speaking, bge-reranker and bge-embedding are still in preview as they are not fast enough for production.
99
* `instinct-llm`: New `JinaRerankerModel` for Reranker model API from Jina.ai.
10-
* `instinct-retrieval`: New `DuckDBBM25Retriever` for BM25 keyword based retriever using DuckDb's built-in function.
10+
* `instinct-retrieval`: New `DuckDBBM25Retriever` for BM25 keyword based retriever using DuckDB's built-in function.
1111
* Improvements
12+
* Move example code to standalone repository: [instinct-cpp-examples](https://github.com/RobinQu/instinct-cpp-examples).
1213
* Rename for all files for camel-case naming conventions
1314
* Build system:
1415
* Fix include paths for internal header files. Now all files are referenced using angle bracket pattern like `#include <instinct/...>`.

conanfile.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class InstinctCppRecipe(ConanFile):
1212
settings = "os", "compiler", "build_type", "arch"
1313
no_copy_source = True
1414
options = {
15+
"shared": [True, False],
1516
# target-level switches
1617
"with_duckdb": [True, False],
1718
"with_exprtk": [True, False],
@@ -23,7 +24,8 @@ class InstinctCppRecipe(ConanFile):
2324
"with_duckdb": True,
2425
"with_exprtk": True,
2526
"with_pdfium": True,
26-
"with_duckx": True
27+
"with_duckx": True,
28+
"shared": True
2729
}
2830

2931
exports_sources = ["CMakeLists.txt", "modules/*", "cmake/*", "LICENSE"]
@@ -88,6 +90,7 @@ def generate(self):
8890
tc.variables["WITH_EXPRTK"] = self.options.with_exprtk
8991
tc.variables["WITH_PDFIUM"] = self.options.with_pdfium
9092
tc.variables["WITH_DUCKX"] = self.options.with_duckx
93+
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
9194
tc.generate()
9295

9396
def build(self):

dockerfile/mini-assistant.dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ RUN --mount=type=cache,id=id=conan-$TARGETARCH$TARGETVARIANT,target=/root/.conan
1717
RUN --mount=type=cache,id=id=conan-$TARGETARCH$TARGETVARIANT,target=/root/.conan2,sharing=locked \
1818
conan install . --build=missing --output-folder=build
1919
RUN --mount=type=cache,id=id=conan-$TARGETARCH$TARGETVARIANT,target=/root/.conan2,sharing=locked \
20-
cd build && \
21-
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON && \
22-
cmake --build . -j $(nproc)
20+
conan build -c tools.build:skip_test=True -o shared=False .
2321

2422

2523
FROM ubuntu:$UBUNTU_VERSION
2624

2725
WORKDIR /app
28-
COPY --from=builder /src/build/modules/instinct-examples/mini-assistant/mini-assistant /app/
26+
COPY --from=builder /src/build/Release/modules/instinct-apps/mini-assistant/mini-assistant /app/
2927
ENTRYPOINT ["/app/mini-assistant"]
3028

docs/library.md

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,60 +12,46 @@ Build requirements:
1212
* Compiler that supports C++ 20: GCC 12+ or Clang 15+
1313
* Conan 2+ (Optional)
1414

15-
### Option 1. Using `conan`
16-
If you are using conan to resolve all dependencies, simple run the `install` command:
15+
Simple run the `install` command:
1716

1817
```shell
1918
conan install conanfile.py --build=missing --output-folder=build
2019
```
2120

22-
To build and install to `/tmp/instinct.cpp`:
21+
As I am still working on publishing this package to conan center, you have to install to local `conan` cache:
2322

24-
```shell
25-
26-
cd build
27-
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/instinct.cpp
28-
cmake --build . -j $(nproc) --target install
2923
```
30-
31-
### Option 2. Using `CMake` only
32-
33-
Some dependencies are expected to be installed in system, and you should make sure they can be found by Cmake's `find_package` command. These libraries include:
34-
35-
* protobuf >= 5.27.0, which brings in `absl` and `googletest` transitively.
36-
* ICU >= 74.1
37-
38-
For example, on macOS you can install them using `brew`:
39-
40-
```shell
41-
brew install protobuf icu4c
24+
conan create .
4225
```
4326

44-
If you prefer `conda`, which is available in Linux, macOS and Windows:
45-
46-
```shell
47-
conda install -c conda-forge icu protobuf libuuid
48-
```
27+
## Quick start
4928

29+
In your project's `conanfile.py`, add `instinct-cpp` as requirement. A working example is hosted [here](https://github.com/RobinQu/instinct-cpp-examples/tree/master/quick_start_simple).
5030

51-
However, It's recommended to build and install these libraries from source because of following reasons:
31+
```py
32+
from conan import ConanFile
33+
from conan.tools.build import check_min_cppstd
5234

53-
1. You can make sure both static and dynamic libraries are available. Some package managers like `brew` only ship dynamic libraries of protobuf so that it may prevent you from linking statically.
54-
2. Mainstream providers like `apt` and `yum` are shipping very old versions of these libraries in "stable" channel.
35+
class YourRecipe(ConanFile):
36+
settings = "os", "compiler", "build_type", "arch"
37+
generators = "CMakeToolchain", "CMakeDeps"
38+
39+
def validate(self):
40+
check_min_cppstd(self, 20)
5541

56-
I know it's possible to build a standalone `protobuf` using Cmake's `FetchContent`. But I haven't figured a proper way to make every pieces working together.
42+
def requirements(self):
43+
# toggle off all switches
44+
# you can turn on for further experiments
45+
self.requires("instinct-cpp/0.1.5")
46+
```
5747

58-
And then just build and install in common practices. Example to build install to `/tmp/instinct.cpp` with default project settings.
48+
And prepare dependencies:
5949

6050
```shell
61-
cd build
62-
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/tmp/instinct.cpp
63-
cmake --build build -j $(nproc) --config Release --target install
51+
conan install conanfile.py --build=missing
6452
```
6553

66-
## Quick start
67-
68-
Let's build a simple text completion task using Ollama API.
54+
Once installed, let's build a simple text completion task using Ollama API.
6955

7056
```c++
7157
#include <instinct/chain/message_chain.hpp>

0 commit comments

Comments
 (0)