-
Notifications
You must be signed in to change notification settings - Fork 13
Add devcontainer env #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM centos:7.9.2009 | ||
|
||
RUN yum -y install centos-release-scl \ | ||
epel-release; \ | ||
yum -y install devtoolset-7-gcc \ | ||
devtoolset-7-gcc-c++ \ | ||
python3 \ | ||
make \ | ||
libtool \ | ||
openssl-devel \ | ||
yum clean all; \ | ||
rm -rf /var/cache/yum; | ||
|
||
ENV PATH /opt/rh/devtoolset-7/root/bin/:$PATH | ||
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 | ||
|
||
ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo | ||
ENV PATH $CARGO_HOME/bin:$PATH | ||
RUN mkdir -p "$CARGO_HOME" && mkdir -p "$RUSTUP_HOME" && \ | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.70.0 && \ | ||
chmod -R a=rwX $CARGO_HOME | ||
RUN cargo install cxxbridge-cmd --version 1.0.18 | ||
|
||
WORKDIR /client-cpp |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "tikv/cpp-client", | ||
"dockerFile": "Dockerfile", | ||
"postAttachCommand": "bash", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"cschleiden.vscode-github-actions", | ||
"vadimcn.vscode-lldb" | ||
], | ||
"settings": { | ||
"editor.formatOnSave": true | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ This client is still in the stage of prove-of-concept and under heavy developmen | |
|
||
## Build | ||
|
||
### Local Build | ||
```bash | ||
# cxxbridge-cmd 1.0.18 requires rustc 1.48+ and c++17 or newer | ||
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 | |
```bash | ||
make release | ||
``` | ||
### Docker build | ||
**Way 1: Use Visual Studio Code Dev Container** | ||
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. | ||
|
||
**Way 2: Build Docker Locally Then Compile** | ||
```bash | ||
docker build -t tikv/client-cpp:latest \ -f .devcontainer/Dockerfile . | ||
docker run -v $(pwd):/client-cpp \ | ||
tikv/client-cpp:latest \ | ||
/bin/bash -c "make release" | ||
``` | ||
|
||
**Way3: Use Image to Compile(Image is NOT Official)** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tisonkun Do we allow personal image? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. It's better to start a proposal build an image with approval of TiKV committers or maintainers instead of recommend a personal docker image in README. @Smityz you can still mention it in the PR description and spread among social media, but TiKV may not endorse it like this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with you, and I will convert this PR to draft until someone builds an official docker image. |
||
```bash | ||
docker run -v $(pwd):/client-cpp \ | ||
registry.cn-hangzhou.aliyuncs.com/smityz/client-cpp:latest \ | ||
/bin/bash -c "make release" | ||
``` | ||
|
||
|
||
## Run example | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on my experience developing a
dev container
for OpenDAL, I recommend usingmcr.microsoft.com/devcontainers/rust:bullseye
and customizing it withpost_create.sh
. For more information, please visit https://github.com/apache/incubator-opendal/tree/main/.devcontainer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, let me try