[Build] feature: add dev container. (#96)

Signed-off-by: doujiang24 <doujiang24@gmail.com>
This commit is contained in:
doujiang24 2025-02-12 10:33:53 +08:00 committed by GitHub
parent 8ef02e2630
commit 7b722877f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 90 additions and 0 deletions

31
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM ubuntu:22.04
WORKDIR /workspaces
RUN apt-get update -y \
&& apt-get install -y vim git wget build-essential cmake net-tools tcpdump
RUN apt-get install -y libibverbs-dev \
libunwind-dev \
libgoogle-glog-dev \
libgtest-dev \
libjsoncpp-dev \
libnuma-dev \
libpython3-dev \
libboost-all-dev \
libssl-dev \
libgrpc-dev \
libgrpc++-dev \
libprotobuf-dev \
protobuf-compiler-grpc \
pybind11-dev \
libcurl4-openssl-dev \
libhiredis-dev
RUN wget https://go.dev/dl/go1.22.12.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf go1.22.12.linux-amd64.tar.gz
ENV GOPROXY='https://goproxy.cn'
ENV PATH=/usr/local/go/bin:$PATH
CMD ["bash"]

34
.devcontainer/README.md Normal file
View File

@ -0,0 +1,34 @@
# Mooncake Dev Container (experimental)
This directory contains some experimental tools for Mooncake Development in [VSCode Remote - Containers](https://code.visualstudio.com/docs/remote/containers).
## How to use
Open with VSCode with the Container extension installed. Follow the [official guide](https://code.visualstudio.com/docs/remote/containers) to open this
repository directly from GitHub or from checked-out source tree.
### Build
```
cd /workspaces/Mooncake
mkdir build
cd build
cmake .. -DUSE_ETCD=OFF -DUSE_HTTP=ON
make -j`nproc` VERBOSE=1
```
### Test
1. start the http metadata server
```
cd /workspaces/Mooncake/mooncake-transfer-engine/example/http-metadata-server
go run . --addr=:8090
```
2. run tests
```
cd /workspaces/Mooncake/build
MC_METADATA_SERVER=http://127.0.0.1:8090/metadata make test -j ARGS="-V"
```

View File

@ -0,0 +1,25 @@
{
"name": "Mooncake Dev",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--cap-add=NET_RAW",
"--cap-add=NET_ADMIN",
"--security-opt=seccomp=unconfined",
"--volume=${env:HOME}:${env:HOME}",
"--network=host",
// Uncomment next line if you have devcontainer.env
// "--env-file=.devcontainer/devcontainer.env"
],
"containerEnv": {
"SRCDIR": "${containerWorkspaceFolder}",
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"bazel.buildifierFixOnFormat": true,
}
}
}
}