Skip to content

Commit c3ac8b9

Browse files
committed
add readme
Signed-off-by: Smityz <smityz@qq.com>
1 parent a2f9fe7 commit c3ac8b9

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM centos:7.9.2009
2+
3+
RUN yum -y install centos-release-scl \
4+
epel-release; \
5+
yum -y install devtoolset-7-gcc \
6+
devtoolset-7-gcc-c++ \
7+
python3 \
8+
make \
9+
libtool \
10+
openssl-devel \
11+
yum clean all; \
12+
rm -rf /var/cache/yum;
13+
14+
ENV PATH /opt/rh/devtoolset-7/root/bin/:$PATH
15+
RUN pip3 install --upgrade pip --no-cache-dir && pip3 install --no-cache-dir cmake==3.26.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
16+
17+
ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo
18+
ENV PATH $CARGO_HOME/bin:$PATH
19+
RUN mkdir -p "$CARGO_HOME" && mkdir -p "$RUSTUP_HOME" && \
20+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.70.0 && \
21+
chmod -R a=rwX $CARGO_HOME
22+
RUN cargo install cxxbridge-cmd --version 1.0.18
23+
24+
WORKDIR /client-cpp

.devcontainer/devcontainer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "tikv/cpp-client",
3+
"dockerFile": "Dockerfile",
4+
"postAttachCommand": "bash",
5+
"customizations": {
6+
"vscode": {
7+
"extensions": [
8+
"cschleiden.vscode-github-actions",
9+
"vadimcn.vscode-lldb"
10+
],
11+
"settings": {
12+
"editor.formatOnSave": true
13+
}
14+
}
15+
}
16+
}

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
TiKV client for C++. So far, it only supports synchronous API.
44

55
It's built on top of
6-
[TiKV Client in Rust](https://github.com/tikv/client-rust) via [cxx](https://github.com/dtolnay/cxx).
6+
[TiKV Client in Rust](https://github.com/tikv/client-cpp) via [cxx](https://github.com/dtolnay/cxx).
77

88
This client is still in the stage of prove-of-concept and under heavy development.
99

1010
## Build
1111

12+
### Local Build
1213
```bash
1314
# cxxbridge-cmd 1.0.18 requires rustc 1.48+ and c++17 or newer
1415
cargo install cxxbridge-cmd --force --version 1.0.18
@@ -23,6 +24,25 @@ Otherwise, you can build release version by the following. The library will be i
2324
```bash
2425
make release
2526
```
27+
### Docker build
28+
**Way 1: Use Visual Studio Code Dev Container**
29+
you can use the dev container to build the project, just open the project in VSCode and press `F1` and select `Dev Containers: Reopen in Container` to open the project in dev container.
30+
31+
**Way 2: Build Docker Locally Then Compile**
32+
```bash
33+
docker build -t tikv/client-cpp:latest \ -f .devcontainer/Dockerfile .
34+
docker run -v $(pwd):/client-cpp \
35+
tikv/client-cpp:latest \
36+
/bin/bash -c "make release"
37+
```
38+
39+
**Way3: Use Image to Compile(Image is NOT Official)**
40+
```bash
41+
docker run -v $(pwd):/client-cpp \
42+
registry.cn-hangzhou.aliyuncs.com/smityz/client-cpp:latest \
43+
/bin/bash -c "make release"
44+
```
45+
2646

2747
## Run example
2848

0 commit comments

Comments
 (0)