Skip to content

Commit 033fca0

Browse files
author
bingtao.yin
committed
update ide file
1 parent c9c43f9 commit 033fca0

File tree

9 files changed

+137
-204
lines changed

9 files changed

+137
-204
lines changed

.devcontainer/.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
HTTP_PROXY=http://192.168.2.1:28080
2+
HTTPS_PROXY=http://192.168.2.1:28080
3+
ALL_PROXY=http://192.168.2.1:28080
4+
BUILD_PROC=80
5+
DEV_USERNAME=dev
6+
USER_UID=1004
7+
USER_GID=1004

.devcontainer/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

.devcontainer/Dockerfile

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
FROM ubuntu:22.04
22

3-
ARG http_proxy
4-
ARG https_proxy
3+
ARG HTTP_PROXY
4+
ARG DEV_USERNAME
5+
ARG USER_UID
6+
ARG USER_GID
57

68
ENV DEBIAN_FRONTEND=noninteractive
7-
ENV http_proxy=${http_proxy}
8-
ENV https_proxy=${https_proxy}
9-
ENV HTTP_PROXY=${http_proxy}
10-
ENV HTTPS_PROXY=${https_proxy}
11-
ENV ALL_PROXY=${http_proxy}
9+
ENV http_proxy=${HTTP_PROXY}
10+
ENV https_proxy=${HTTP_PROXY}
11+
ENV HTTP_PROXY=${HTTP_PROXY}
12+
ENV HTTPS_PROXY=${HTTP_PROXY}
13+
ENV ALL_PROXY=${HTTP_PROXY}
1214
ENV DORIS_BUILD_PYTHON_VERSION=python3
1315
ENV DORIS_TOOLCHAIN=gcc
16+
ENV CLANGD_VERSION=21.1.0
17+
ENV CLANGD_HOME=/usr/local/lib/clangd
1418
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
15-
ENV PATH=${JAVA_HOME}/bin:${PATH}
19+
ENV PATH=${JAVA_HOME}/bin:${CLANGD_HOME}/bin:${PATH}
1620
ENV TZ=Asia/Shanghai
1721

1822
RUN \
@@ -40,18 +44,39 @@ RUN \
4044
PKGS="${PKGS} libkrb5-dev" && \
4145
# misc
4246
PKGS="${PKGS} mysql-client" && \
43-
apt-get install -y ${PKGS} && \
44-
apt-get autoclean && apt-get autoremove && \
45-
rm -rf /var/lib/apt/lists/*
47+
apt-get install -y ${PKGS} && \
48+
apt-get autoclean
4649

47-
ENV LC_ALL="en_US.UTF-8"
48-
ENV LANG="en_US.UTF-8"
50+
RUN \
51+
# clangd
52+
wget "https://github.com/clangd/clangd/releases/download/${CLANGD_VERSION}/clangd-linux-${CLANGD_VERSION}.zip" -O /tmp/clangd.zip && \
53+
unzip /tmp/clangd.zip -d ${CLANGD_HOME} && \
54+
mv ${CLANGD_HOME}/clangd_${CLANGD_VERSION}/* ${CLANGD_HOME} && \
55+
rm -rf ${CLANGD_HOME}/clangd_${CLANGD_VERSION} && \
56+
rm -rf /tmp/clangd.zip
4957

5058
RUN \
5159
# proxy for wget
52-
echo "use_proxy = on" >> /root/.wgetrc && \
53-
echo "http_proxy = ${http_proxy}" >> /root/.wgetrc && \
54-
echo "https_proxy = ${https_proxy}" >> /root/.wgetrc
60+
echo "use_proxy = on" >> /etc/wgetrc && \
61+
echo "http_proxy = ${http_proxy}" >> /etc/wgetrc && \
62+
echo "https_proxy = ${http_proxy}" >> /etc/wgetrc && \
63+
# misc
64+
echo "* soft core unlimited" >>/etc/security/limits.conf
65+
66+
RUN \
67+
# Create the user
68+
groupadd --gid $USER_GID $DEV_USERNAME \
69+
&& useradd --uid $USER_UID --gid $USER_GID -m $DEV_USERNAME \
70+
#
71+
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
72+
&& echo $DEV_USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$DEV_USERNAME \
73+
&& chmod 0440 /etc/sudoers.d/$DEV_USERNAME
74+
75+
ENV LC_ALL="en_US.UTF-8"
76+
ENV LANG="en_US.UTF-8"
5577

56-
WORKDIR /opt/transwarp/doris
78+
USER $DEV_USERNAME
5779

80+
# unset
81+
ENV http_proxy=
82+
ENV https_proxy=

.devcontainer/build.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 37 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,41 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
33
{
4-
"name": "doris dev",
5-
"image": "doris_build:20250707_8849ea0415",
6-
"runArgs": [
7-
"--network=host",
8-
"--privileged",
9-
"--cap-add=SYS_PTRACE",
10-
"--security-opt",
11-
"seccomp=unconfined",
12-
"--env-file",".devcontainer/.env"
13-
],
14-
"mounts": [
15-
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
16-
"source=${localEnv:LOCAL_MVN_REPO},target=/root/.m2,type=bind",
17-
"source=${localEnv:LOCAL_CCACHE},target=/opt/ccache,type=bind"
18-
],
19-
"workspaceMount": "source=${localWorkspaceFolder},target=/opt/transwarp/doris,type=bind,consistency=cached",
20-
"workspaceFolder": "/opt/transwarp/doris",
21-
"customizations": {
22-
"vscode": {
23-
// Set *default* container specific settings.json values on container create.
24-
"settings": {
25-
"terminal.integrated.shell.linux": "/bin/bash",
26-
"C_Cpp.default.cppStandard": "c++20",
27-
"C_Cpp.default.cStandard": "c17",
28-
"C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/.browse.c_cpp.db",
29-
},
30-
// Add the IDs of extensions you want installed when the container is created.
31-
"extensions": [
32-
"ms-vscode.cpptools",
33-
"ms-vscode.cpptools-extension-pack",
34-
"foxundermoon.shell-format",
35-
"redhat.vscode-yaml",
36-
"ms-azuretools.vscode-docker",
37-
"ms-vscode.cmake-tools",
38-
"josetr.cmake-language-support-vscode",
39-
"cheshirekow.cmake-format",
40-
"EditorConfig.EditorConfig",
41-
"cschlosser.doxdocgen",
42-
"codezombiech.gitignore",
43-
"SonarSource.sonarlint-vscode",
44-
"GitHub.copilot",
45-
"zxh404.vscode-proto3",
46-
"llvm-vs-code-extensions.vscode-clangd",
47-
"cduruk.thrift"
48-
]
49-
}
50-
},
51-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
52-
// "forwardPorts": [],
53-
// Use 'postCreateCommand' to run commands after the container is created.
54-
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh"
55-
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
56-
// "remoteUser": "vscode"
4+
"name": "doris dev",
5+
"dockerComposeFile": "docker-compose.yml",
6+
"service": "doris_dev_service",
7+
"workspaceFolder": "/opt/transwarp/doris",
8+
"customizations": {
9+
"vscode": {
10+
// Set *default* container specific settings.json values on container create.
11+
"settings": {},
12+
// Add the IDs of extensions you want installed when the container is created.
13+
"extensions": [
14+
"ms-vscode.cpptools",
15+
"ms-vscode.cpptools-extension-pack",
16+
"foxundermoon.shell-format",
17+
"redhat.vscode-yaml",
18+
"ms-azuretools.vscode-docker",
19+
"ms-vscode.cmake-tools",
20+
"josetr.cmake-language-support-vscode",
21+
"cheshirekow.cmake-format",
22+
"EditorConfig.EditorConfig",
23+
"cschlosser.doxdocgen",
24+
"codezombiech.gitignore",
25+
"SonarSource.sonarlint-vscode",
26+
"GitHub.copilot",
27+
"zxh404.vscode-proto3",
28+
"llvm-vs-code-extensions.vscode-clangd",
29+
"cduruk.thrift"
30+
]
31+
}
32+
},
33+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
34+
// "forwardPorts": [],
35+
// Use 'postCreateCommand' to run commands after the container is created.
36+
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",
37+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
38+
// "remoteUser": "dev"
39+
// leave the containers running when VS Code closes
40+
"shutdownAction": "none"
5741
}

.devcontainer/docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
services:
2+
doris_dev_service:
3+
build:
4+
context: .
5+
network: host
6+
dockerfile: Dockerfile
7+
args:
8+
- HTTP_PROXY
9+
- DEV_USERNAME
10+
- USER_UID
11+
- USER_GID
12+
env_file:
13+
- .env
14+
container_name: doris_dev
15+
privileged: true
16+
cap_add:
17+
- SYS_PTRACE
18+
security_opt:
19+
- seccomp=unconfined
20+
volumes:
21+
- ..:/opt/transwarp/doris:cached
22+
- /var/run/docker.sock:/var/run/docker.sock
23+
- ${LOCAL_MVN_REPO}:/home/dev/.m2:cached
24+
- ${LOCAL_CCACHE}:/opt/ccache:cached
25+
working_dir: /opt/transwarp/doris
26+
network_mode: host
27+
tty: true
28+
stdin_open: true

.devcontainer/postCreateCommand.sh

Lines changed: 8 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,20 @@
11
#!/bin/bash
22

3-
function install_by_script {
4-
cd ~/
5-
wget https://dot.net/v1/dotnet-install.sh
6-
sudo chmod +x ./dotnet-install.sh
7-
./dotnet-install.sh --channel 6.0
8-
9-
echo 'export DOTNET_ROOT=$HOME/.dotnet' >>~/.bashrc
10-
echo 'export PATH=$HOME/.dotnet:$HOME/.dotnet/tools:$PATH' >>~/.bashrc
11-
}
12-
13-
function install_by_dnf {
14-
rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpm
15-
dnf install -y dotnet-sdk-6.0 dotnet-runtime-6.0
16-
mkdir -p /root/.dotnet
17-
ln -s /usr/bin/dotnet /root/.dotnet/dotnet
18-
}
19-
20-
function create_user {
21-
USERNAME=dev
22-
USER_UID=1000
23-
USER_GID=$USER_UID
24-
25-
# Create the user
26-
groupadd --gid $USER_GID $USERNAME
27-
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
28-
29-
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
30-
apt install -y sudo
31-
echo $USERNAME ALL=\(root\) NOPASSWD:ALL >/etc/sudoers.d/$USERNAME
32-
chmod 0440 /etc/sudoers.d/$USERNAME
33-
}
34-
35-
function install_clangd {
36-
clangd_dir=/usr/local/lib/clangd
37-
38-
wget "https://github.com/clangd/clangd/releases/download/17.0.3/clangd-linux-17.0.3.zip" -O /tmp/clangd.zip
39-
unzip /tmp/clangd.zip -d ${clangd_dir}
40-
mv ${clangd_dir}/clangd_17.0.3/* ${clangd_dir}
41-
rm -rf ${clangd_dir}/clangd_17.0.3
42-
rm -rf /tmp/clangd.zip
43-
44-
unset clangd_dir
45-
}
46-
473
function main {
484
# need to reload vscode to enable cmake language server
495

50-
# install_by_script
51-
# install_by_dnf
52-
53-
# install other deps
54-
55-
install_clangd
56-
57-
mkdir -p /root/.ccache
58-
echo "max_size = 20.0G" >>/root/.ccache/ccache.conf
59-
echo "cache_dir = /opt/ccache" >> /root/.ccache/ccache.conf
60-
61-
create_user
6+
# enable coredump
7+
sudo sysctl -w kernel.core_pattern="/coredumps/core-%e-%s-%u-%g-%p-%t"
628

63-
# echo "unset http_proxy" >>/root/.bashrc
64-
# echo "unset https_proxy" >>/root/.bashrc
65-
echo 'export PATH=/usr/local/lib/clangd/bin/:$PATH' >>/root/.bashrc
9+
mkdir -p $HOME/.config/ccache
10+
echo "cache_dir = /opt/ccache" >> $HOME/.config/ccache/ccache.conf
11+
echo "max_size = 20.0G" >> $HOME/.config/ccache/ccache.conf
6612

67-
# enable coredump
68-
echo "* soft core unlimited" >>/etc/security/limits.conf
69-
sysctl -w kernel.core_pattern="/coredumps/core-%e-%s-%u-%g-%p-%t"
13+
echo "unset http_proxy" >> $HOME/.bashrc
14+
echo "unset https_proxy" >> $HOME/.bashrc
7015

7116
# replace container settings.json with our project settings.json
72-
pushd /root/.vscode-server/data/Machine
17+
pushd $HOME/.vscode-server/data/Machine
7318
rm -rf settings.json
7419
ln -s /opt/transwarp/doris/.devcontainer/settings.json settings.json
7520
popd

.devcontainer/settings.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:disable",
3-
"sonarlint.pathToCompileCommands": "/opt/transwarp/doris/be/build_Release/compile_commands.json",
3+
"sonarlint.pathToCompileCommands": "/opt/transwarp/doris/be/build_Debug/compile_commands.json",
44
"sonarlint.testFilePattern": "{/opt/transwarp/doris/thirdparty/installed/include/**, /usr/include/**}",
55
"cmake.generator": "Unix Makefiles",
66
"editor.quickSuggestions": {
@@ -35,10 +35,22 @@
3535
"--cross-file-rename",
3636
"--compile-commands-dir=/opt/transwarp/doris/be/build_Debug",
3737
"--completion-style=detailed",
38-
"-j=40",
38+
"-j=${BUILD_PROC}",
3939
"--all-scopes-completion",
4040
// "--limit-references=100",
4141
// "--limit-results=20",
4242
"--malloc-trim"
4343
],
44+
"terminal.integrated.shell.linux": {
45+
"bash (login)": {
46+
"path": "/bin/bash",
47+
"args": [
48+
"-l"
49+
]
50+
}
51+
},
52+
"terminal.integrated.defaultProfile.linux": "bash",
53+
"C_Cpp.default.cppStandard": "c++20",
54+
"C_Cpp.default.cStandard": "c17",
55+
"C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/.browse.c_cpp.db",
4456
}

0 commit comments

Comments
 (0)