Commit Graph

2 Commits (e0f97d460bbcbe23dd95d048cfdd89bfee33eaa7)

Author SHA1 Message Date
Sipho Mokoena c0720f0743 refactor: make devcontainer configuration portable and user-agnostic
Improve devcontainer robustness by eliminating hardcoded paths and user assumptions:

devcontainer.json changes:
- Replace hardcoded /workspaces/velxio paths with ${containerWorkspaceFolder} variable
- Ensures compatibility with GitHub Codespaces and other workspace path variations
- Update all volume mount targets and PATH environment variable to use dynamic paths

post-create.sh improvements:
- Dynamically detect workspace root from script location instead of assuming /workspaces/velxio
- Use $(whoami) to get current user instead of hardcoding 'vscode' user
- Replace absolute paths with relative paths for all operations
- Makes script work correctly in any devcontainer environment (VS Code, Codespaces, Gitpod)

post-start.sh improvements:
- Apply same dynamic workspace root detection pattern
- Use current user instead of hardcoded 'vscode' for chown operations
- Ensures ownership fixes work regardless of container user configuration

These changes enable the devcontainer to work seamlessly across different hosting environments without requiring manual configuration adjustments.
2026-03-27 04:43:29 +02:00
Sipho Mokoena c1b9244341 feat: add VS Code devcontainer configuration with optimized setup
- Add .devcontainer/devcontainer.json with Python 3.12 + Node 20 base image
  - Added remoteUser: vscode to avoid running as root
  - Configured named volumes for node_modules (frontend + 3 wokwi-libs) to improve I/O performance on non-Linux hosts
  - Added volume for arduino-cli cache at /home/vscode/.arduino15
  - Added remoteEnv PATH to include node_modules/.bin and venv/bin
  - Configured port forwarding for 5173 (Vite) and 8001 (FastAPI)

- Add .devcontainer/post-create.sh for initial container setup
  - Fix ownership of node_modules volumes with chown vscode:vscode
  - Install arduino-cli with sudo to /usr/local/bin
  - Install Arduino cores (arduino:avr, rp2040:rp2040) with duplicate guards
  - Set up Python venv with base deps (wheel, setuptools) before requirements.txt
  - Install npm deps with HUSKY=0 to disable git hooks in container environment
  - Build wokwi-libs (avr8js, rp2040js, wokwi-elements) in parallel
  - All installs run in parallel background jobs with wait for optimal performance

- Add .devcontainer/post-start.sh for incremental updates on container restart
  - Lightweight sync of Python and npm dependencies
  - Runs on every container start for drift detection

- Add wokwi-boards submodule for ESP32/Pico board SVG assets
  - Code imports board.svg files from wokwi-libs/wokwi-boards/boards/
  - Submodule was referenced but not initialized, causing Vite import errors

- Configure Vite to bind to 0.0.0.0:5173 for devcontainer port forwarding
  - Default 127.0.0.1 binding is not accessible from outside container
  - Explicit host/port config enables VS Code port forwarding to work
2026-03-27 01:59:48 +00:00