Skip to content

Commit 266f311

Browse files
committed
Add devcontainer (cli)
1 parent c8dfb76 commit 266f311

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "Ubuntu Development Environment",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/python:1": {
7+
"version": "3.12"
8+
},
9+
"ghcr.io/devcontainers/features/git:1": {},
10+
"ghcr.io/devcontainers/features/node:1": {
11+
"version": "20"
12+
}
13+
},
14+
15+
"customizations": {
16+
"vscode": {
17+
"extensions": [
18+
"platformio.platformio-ide",
19+
"ms-vscode.cpptools-extension-pack",
20+
"ms-python.python"
21+
],
22+
"settings": {
23+
"C_Cpp.default.intelliSenseMode": "gcc-x64",
24+
"C_Cpp.default.compilerPath": "/usr/bin/gcc",
25+
"editor.tabSize": 2,
26+
"editor.insertSpaces": true,
27+
"files.associations": {
28+
"*.ino": "cpp",
29+
"*.h": "c",
30+
"*.hpp": "cpp"
31+
}
32+
}
33+
}
34+
},
35+
36+
"postCreateCommand": "bash .devcontainer/setup.sh",
37+
38+
"remoteUser": "vscode",
39+
40+
"mounts": [
41+
"source=/dev,target=/dev,type=bind,consistency=cached"
42+
],
43+
44+
"runArgs": [
45+
"--privileged"
46+
]
47+
}

.devcontainer/setup.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
3+
# Setup script for Ubuntu development environment
4+
5+
set -e
6+
7+
echo "Setting up development environment..."
8+
9+
# Update package lists
10+
sudo apt-get update
11+
12+
# Install essential development tools
13+
sudo apt-get install -y \
14+
build-essential \
15+
git \
16+
curl \
17+
wget \
18+
unzip \
19+
software-properties-common \
20+
udev \
21+
python3-pip \
22+
python3-venv \
23+
pkg-config \
24+
libusb-1.0-0-dev \
25+
libudev-dev
26+
27+
# Install PlatformIO
28+
echo "Installing PlatformIO..."
29+
python3 -m pip install --upgrade pip
30+
python3 -m pip install --upgrade platformio
31+
32+
# Add PlatformIO to PATH
33+
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
34+
35+
# Install PlatformIO udev rules for device access
36+
echo "Setting up udev rules for device access..."
37+
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
38+
sudo service udev restart
39+
sudo usermod -a -G dialout $USER
40+
sudo usermod -a -G plugdev $USER
41+
42+
# Create a symlink for common Arduino libraries location
43+
mkdir -p ~/Arduino/libraries
44+
45+
# Install additional Python packages that might be useful
46+
python3 -m pip install --upgrade \
47+
esptool \
48+
adafruit-ampy \
49+
pyserial
50+
51+
# Install Gemini CLI
52+
echo "Installing Gemini CLI..."
53+
curl -sS https://storage.googleapis.com/gemini-cli/install.sh | bash
54+
55+
# Set up Git configuration (if not already configured)
56+
if [ -z "$(git config --global user.name)" ]; then
57+
echo "Git user name not configured. You may want to run:"
58+
echo "git config --global user.name 'Your Name'"
59+
echo "git config --global user.email 'your.email@example.com'"
60+
fi
61+
62+
echo "✅ Development environment setup complete!"
63+
echo ""
64+
echo "🚀 You can now:"
65+
echo " - Use 'pio' commands for PlatformIO operations"
66+
echo " - Use 'node' and 'npm' for JavaScript/TypeScript development"
67+
echo " - Develop Arduino/ESP32 projects with IntelliSense"
68+
echo ""
69+
echo "📋 Next steps:"
70+
echo " 1. Run 'pio run' to build the project"
71+
echo " 2. Run 'pio device list' to see connected devices"
72+
echo " 3. Use 'pio run --target upload' to flash firmware"
73+
echo ""
74+
echo "🔧 Hardware debugging:"
75+
echo " - USB devices are mounted with --privileged access"
76+
echo " - Serial ports should be accessible in /dev/"

0 commit comments

Comments
 (0)