-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add compile using docker * Update 7.compile-using-docker.md
- Loading branch information
1 parent
129cec3
commit 6b2b485
Showing
2 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
...t-and-installation/2.compile-and-install-nebula-graph/7.compile-using-docker.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
|
||
# Compile NebulaGraph using Docker | ||
|
||
NebulaGraph's source code is written in C++. Compiling NebulaGraph requires certain dependencies which might conflict with host system dependencies, potentially causing compilation failures. Docker offers a solution to this. NebulaGraph provides a Docker image containing the complete compilation environment, ensuring an efficient build process and avoiding host OS conflicts. This guide outlines the steps to compile NebulaGraph using Docker. | ||
|
||
## Prerequisites | ||
|
||
Before you begin: | ||
|
||
1. **Docker**: Ensure Docker is installed on your system. | ||
|
||
2. **Clone NebulaGraph's Source Code**: Clone the repository locally using: | ||
|
||
```bash | ||
git clone --branch {{nebula.branch}} https://github.com/vesoft-inc/nebula.git | ||
``` | ||
|
||
This clones the NebulaGraph source code to a subdirectory named `nebula`. | ||
|
||
## Compilation steps | ||
|
||
1. Pull the NebulaGraph compilation image. | ||
|
||
```bash | ||
docker pull vesoft/nebula-dev:ubuntu2004 | ||
``` | ||
|
||
Here, we use the official NebulaGraph compilation image, `ubuntu2004`. For different versions, see [nebula-dev-docker](https://github.com/vesoft-inc/nebula-dev-docker/#nebula-graph-development-docker-image). | ||
|
||
2. Start the compilation container. | ||
|
||
```bash | ||
docker run -ti \ | ||
--security-opt seccomp=unconfined \ | ||
-v "$PWD":/home \ | ||
-w /home \ | ||
--name nebula_dev \ | ||
vesoft/nebula-dev:ubuntu2004 \ | ||
bash | ||
``` | ||
|
||
- `--security-opt seccomp=unconfined`: Disables the seccomp security mechanism to avoid compilation errors. | ||
|
||
- `-v "$PWD":/home`: Mounts the local path of the NebulaGraph code to the container's `/home` directory. | ||
- `-w /home`: Sets the container's working directory to `/home`. Any command run inside the container will use this directory as the current directory. | ||
|
||
- `--name nebula_dev`: Assigns a name to the container, making it easier to manage and operate. | ||
|
||
- `vesoft/nebula-dev:ubuntu2004`: Uses the `ubuntu2004` version of the `vesoft/nebula-dev` compilation image. | ||
|
||
- `bash`: Executes the `bash` command inside the container, entering the container's interactive terminal. | ||
After executing this command, you'll enter an interactive terminal inside the container. To re-enter the container, use `docker exec -ti nebula_dev bash`. | ||
|
||
3. Compile NebulaGraph inside the container. | ||
|
||
1. Enter the NebulaGraph source code directory. | ||
|
||
```docker | ||
cd nebula | ||
``` | ||
|
||
2. Create a build directory and enter it. | ||
|
||
```docker | ||
mkdir build && cd build | ||
``` | ||
|
||
3. Use CMake to generate the Makefile. | ||
|
||
```docker | ||
cmake -DCMAKE_CXX_COMPILER=$TOOLSET_CLANG_DIR/bin/g++ -DCMAKE_C_COMPILER=$TOOLSET_CLANG_DIR/bin/gcc -DENABLE_WERROR=OFF -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=OFF .. | ||
``` | ||
For more on CMake, see [CMake Parameters](1.install-nebula-graph-by-compiling-the-source-code.md#cmake_variables). | ||
|
||
4. Compile NebulaGraph. | ||
|
||
```docker | ||
# The -j parameter specifies the number of threads to use. | ||
# If you have a multi-core CPU, you can use more threads to speed up compilation. | ||
make -j2 | ||
``` | ||
|
||
Compilation might take some time based on your system performance. | ||
|
||
4. Install the Executables and Libraries. | ||
|
||
Post successful compilation, NebulaGraph's binaries and libraries are located in `/home/nebula/build`. Install them to `/usr/local/nebula`: | ||
```docker | ||
make install | ||
``` | ||
Once completed, NebulaGraph is compiled and installed in the host directory `/usr/local/nebula`. | ||
## Next Steps | ||
- [Start NebulaGraph Service](../manage-service.md) | ||
- [Connect to NebulaGraph](../connect-to-nebula-graph.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters