mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-10 05:19:44 +00:00
feat(build):add vscode devcontainer config
This commit is contained in:
40
.devcontainer/Dockerfile.dev
Normal file
40
.devcontainer/Dockerfile.dev
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM eosphorosai/dbgpt:latest
|
||||
ARG EXTRAS="proxy_openai,rag,storage_chromadb,quant_bnb,graph_rag"
|
||||
ARG PYTHON_VERSION=3.10
|
||||
ARG USER_UID=1001
|
||||
ARG USER_GID=1001
|
||||
ARG USER=work
|
||||
ARG PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
USER root
|
||||
# Set the GID and UID of the container and
|
||||
# add a user to prevent permission mismatches
|
||||
# between the container user (root) and the host user,
|
||||
# and to resolve the issue of the host user lacking write permissions.
|
||||
RUN groupadd -g $USER_GID $USER && \
|
||||
useradd -u $USER_UID -g $USER_GID -m $USER && \
|
||||
chown -R $USER_UID:$USER_GID /app
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
wget \
|
||||
ssh zsh autojump curl git-flow vim sudo \
|
||||
&& python${PYTHON_VERSION} -m pip install --upgrade pip \
|
||||
&& python${PYTHON_VERSION} -m pip install --upgrade pipx \
|
||||
&& pipx install uv --global \
|
||||
&& chown -R $USER:$USER /opt/.uv.venv \
|
||||
&& echo "$USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USER \
|
||||
&& chmod 0440 /etc/sudoers.d/$USER
|
||||
USER $USER
|
||||
ENV UV_LINK_MODE=copy
|
||||
RUN /opt/.uv.venv/bin/python3 -m pip install uv -i https://mirrors.aliyun.com/pypi/simple/ && \
|
||||
extras=$(echo $EXTRAS | tr ',' '\n' | while read extra; do echo "--extra $extra"; done | tr '\n' ' ') && \
|
||||
echo $extras && \
|
||||
/opt/.uv.venv/bin/uv pip install -r pyproject.toml --all-extras && \
|
||||
/opt/.uv.venv/bin/uv pip install -r requirements/dev-requirements.txt && \
|
||||
/opt/.uv.venv/bin/uv pip install -r requirements/lint-requirements.txt && \
|
||||
cp .devcontainer/dbgpt.pth /opt/.uv.venv/lib/python3.10/site-packages/dbgpt.pth && \
|
||||
python -c "import dbgpt; print(dbgpt.__version__)"
|
8
.devcontainer/dbgpt.pth
Normal file
8
.devcontainer/dbgpt.pth
Normal file
@@ -0,0 +1,8 @@
|
||||
/app/packages/dbgpt-app/src
|
||||
/app/packages/dbgpt-accelerator
|
||||
/app/packages/dbgpt-accelerator/src
|
||||
/app/packages/dbgpt-core/src
|
||||
/app/packages/dbgpt-client/src
|
||||
/app/packages/dbgpt-ext/src
|
||||
/app/packages/dbgpt-serve/src
|
||||
/app/packages/dbgpt-app/src
|
54
.devcontainer/post-create.sh
Executable file
54
.devcontainer/post-create.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd /app
|
||||
# Install Oh My Zsh
|
||||
if [ ! -d ~/.oh-my-zsh ]; then
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||
fi
|
||||
|
||||
# Install plugins
|
||||
plugins=(
|
||||
"zsh-users/zsh-autosuggestions"
|
||||
"zsh-users/zsh-syntax-highlighting"
|
||||
)
|
||||
|
||||
for plugin in "${plugins[@]}"; do
|
||||
repo_name=$(basename $plugin)
|
||||
if [ ! -d ~/.oh-my-zsh/custom/plugins/$repo_name ]; then
|
||||
git clone --depth=1 https://github.com/$plugin.git ~/.oh-my-zsh/custom/plugins/$repo_name
|
||||
fi
|
||||
done
|
||||
|
||||
# Install theme
|
||||
if [ ! -d ~/.oh-my-zsh/custom/themes/powerlevel10k ]; then
|
||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
|
||||
fi
|
||||
|
||||
# Apply custom configuration
|
||||
if [ -f /workspace/.devcontainer/zshrc-config ]; then
|
||||
cp /workspace/.devcontainer/zshrc-config ~/.zshrc
|
||||
else
|
||||
# Generate basic .zshrc if no custom configuration exists
|
||||
cat << EOF > ~/.zshrc
|
||||
export ZSH="\$HOME/.oh-my-zsh"
|
||||
ZSH_THEME="robbyrussell"
|
||||
plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump)
|
||||
source \$ZSH/oh-my-zsh.sh
|
||||
|
||||
# Enable autojump
|
||||
[[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Ensure autojump configuration is applied (even if custom configuration exists)
|
||||
if ! grep -q "autojump.sh" ~/.zshrc; then
|
||||
echo '[[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh' >> ~/.zshrc
|
||||
fi
|
||||
cat << EOF >> ~/.zshrc
|
||||
# Add the following to ~/.zshrc
|
||||
if [ -f /app/.env ]; then
|
||||
export $(grep -vE '^#|^$' /app/.env | xargs)
|
||||
fi
|
||||
EOF
|
||||
rm -rf .venv.make
|
||||
echo "Post-create setup completed!"
|
Reference in New Issue
Block a user