From 7b722877f8852df3776d1a97ee7084db0f4a5222 Mon Sep 17 00:00:00 2001 From: doujiang24 Date: Wed, 12 Feb 2025 10:33:53 +0800 Subject: [PATCH] [Build] feature: add dev container. (#96) Signed-off-by: doujiang24 --- .devcontainer/Dockerfile | 31 ++++++++++++++++++++++++++++++ .devcontainer/README.md | 34 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 25 ++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/README.md create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..9add570d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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"] diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 00000000..1f8cbbd5 --- /dev/null +++ b/.devcontainer/README.md @@ -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" +``` diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..7df63069 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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, + } + } + } +} \ No newline at end of file