Skip to content

Conversation

geebytes
Copy link
Contributor

@geebytes geebytes commented Mar 14, 2025

Description

Compatible with Linux and Windows Subsystem for Linux (WSL) environments only.

  • Add VS Code devcontainer development environment configuration

  • Use VS Code's ​Dev Container extension to build a containerized development environment. Leverage the eosphorosai/dbgpt:latest image as the development environment to avoid repeated dependency installations and improve development efficiency.

  • Follow the guide Developing inside a Container to set up the Dev Container:

    • Install the ​Dev Containers extension.
    • Use the shortcut Ctrl+Shift+P to open the command palette, then enter Dev Containers: Open Folder in Container.
  • Set git ssh sharing-git-credentials

  • Before the first launch, please execute the .devcontainer/init_env.sh script in the project root directory in host.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Snapshots:

Include snapshots for easier review.

Checklist:

  • My code follows the style guidelines of this project
  • I have already rebased the commits and make the commit message conform to the project standard.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions bot added the internal DB-GPT internal flag(chore|ci|refactor|test) label Mar 14, 2025
@Aries-ckt
Copy link
Collaborator

hi, @geebytes thanks for your contribution, can you describe how to use this feature?

@geebytes
Copy link
Contributor Author

hi, @geebytes thanks for your contribution, can you describe how to use this feature?
I've added the description

@fangyinc
Copy link
Collaborator

fangyinc commented Mar 15, 2025

Hi @geebytes. Thanks for your PR.

But I encountered some problems. My development system is Ubuntu 24.04. The configuration will report an error:

[2025-03-15T13:08:41.919Z] Stop (4 ms): Setup shutdown monitor
[2025-03-15T13:08:41.920Z] Start: Run in container: test -d '/home/work/.vscode-server'
[2025-03-15T13:08:41.920Z] 
[2025-03-15T13:08:41.920Z] 
[2025-03-15T13:08:41.920Z] Exit code 1
[2025-03-15T13:08:41.920Z] Stop (0 ms): Run in container: test -d '/home/work/.vscode-server'
[2025-03-15T13:08:41.920Z] Start: Run in container: test -d '/home/work/.vscode-remote'
[2025-03-15T13:08:41.920Z] 
[2025-03-15T13:08:41.920Z] 
[2025-03-15T13:08:41.920Z] Exit code 1
[2025-03-15T13:08:41.920Z] Stop (0 ms): Run in container: test -d '/home/work/.vscode-remote'
[2025-03-15T13:08:41.921Z] Start: Run in container: test ! -f '/home/work/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/home/work/.vscode-server/data/Machine' && { > '/home/work/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[2025-03-15T13:08:41.921Z] 
[2025-03-15T13:08:41.921Z] mkdir: cannot create directory ‘/home/work’: Permission denied
[2025-03-15T13:08:41.921Z] Exit code 1
[2025-03-15T13:08:41.921Z] Stop (0 ms): Run in container: test ! -f '/home/work/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/home/work/.vscode-server/data/Machine' && { > '/home/work/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[2025-03-15T13:08:41.921Z] Start: Run in container: cat /home/work/.vscode-server/data/Machine/settings.json
[2025-03-15T13:08:41.922Z] 
[2025-03-15T13:08:41.922Z] cat: /home/work/.vscode-server/data/Machine/settings.json: Permission denied
[2025-03-15T13:08:41.922Z] Exit code 1
[2025-03-15T13:08:41.922Z] Stop (1 ms): Run in container: cat /home/work/.vscode-server/data/Machine/settings.json
[2025-03-15T13:08:41.922Z] Start: Run in container: test -d '/home/work/.vscode-server/bin/e54c774e0add60467559eb0d1e229c6452cf8447'
[2025-03-15T13:08:41.922Z] 
[2025-03-15T13:08:41.922Z] 
[2025-03-15T13:08:41.922Z] Exit code 1
[2025-03-15T13:08:41.922Z] Stop (0 ms): Run in container: test -d '/home/work/.vscode-server/bin/e54c774e0add60467559eb0d1e229c6452cf8447'
[2025-03-15T13:08:41.922Z] Start: Run in container: test -d '/vscode/vscode-server/bin/linux-x64/e54c774e0add60467559eb0d1e229c6452cf8447'
[2025-03-15T13:08:41.923Z] 
[2025-03-15T13:08:41.923Z] 
[2025-03-15T13:08:41.923Z] Stop (1 ms): Run in container: test -d '/vscode/vscode-server/bin/linux-x64/e54c774e0add60467559eb0d1e229c6452cf8447'
[2025-03-15T13:08:41.923Z] Start: Run in container: mkdir -p '/home/work/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/e54c774e0add60467559eb0d1e229c6452cf8447' '/home/work/.vscode-server/bin/e54c774e0add60467559eb0d1e229c6452cf8447'
[2025-03-15T13:08:41.923Z] 
[2025-03-15T13:08:41.923Z] mkdir: cannot create directory ‘/home/work’: Permission denied
[2025-03-15T13:08:41.923Z] Exit code 1
[2025-03-15T13:08:41.923Z] Stop (0 ms): Run in container: mkdir -p '/home/work/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/e54c774e0add60467559eb0d1e229c6452cf8447' '/home/work/.vscode-server/bin/e54c774e0add60467559eb0d1e229c6452cf8447'
[2025-03-15T13:08:41.925Z] Command in container failed: mkdir -p '/home/work/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/e54c774e0add60467559eb0d1e229c6452cf8447' '/home/work/.vscode-server/bin/e54c774e0add60467559eb0d1e229c6452cf8447'
[2025-03-15T13:08:41.926Z] mkdir: cannot create directory ‘/home/work’: Permission denied
[2025-03-15T13:08:41.926Z] Exit code 1

And the default python version is 3.11 in docker image eosphorosai/dbgpt:latest, may be we can modify python version in .devcontainer/Dockerfile.dev file:

ARG PYTHON_VERSION=3.11

....

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/python${PYTHON_VERSION}/site-packages/dbgpt.pth && \
    python -c "import dbgpt; print(dbgpt.__version__)"

@geebytes geebytes force-pushed the feature/feat-devcontainer branch 4 times, most recently from b2271db to d1d53de Compare March 17, 2025 10:14
chore(build):Optimize the zsh setup

fix(dev):Load .env on demand

fix(dev):install oh-my-zsh from mirror
@geebytes geebytes force-pushed the feature/feat-devcontainer branch from 3d28de1 to 599ebff Compare March 17, 2025 15:25
@geebytes
Copy link
Contributor Author

@Aries-ckt @fangyinc hi,I’ve squashed the bugs and made the logic way more flexible now.

Copy link
Collaborator

@fangyinc fangyinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thank you for your contribution, using Dev Container in DB-GPT is super cool, I really love it, thanks again!

Copy link
Collaborator

@Aries-ckt Aries-ckt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contribution

@Aries-ckt Aries-ckt merged commit 4af28e4 into eosphoros-ai:main Mar 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal DB-GPT internal flag(chore|ci|refactor|test)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants