Public Access
chore: rename devcontainer, use none root user and install claude code mcp server
Signed-off-by: bullshit <coding@ow-software.pl>
This commit is contained in:
3 files changed
+28
-8
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# Use ESPHome image as base
|
||||
FROM ghcr.io/esphome/esphome:latest
|
||||
|
||||
# Create non-root user and add to necessary groups
|
||||
ARG USERNAME=esphome
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
|
||||
RUN groupadd --gid $USER_GID $USERNAME \
|
||||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
|
||||
&& apt-get update && apt-get install -y sudo dialog \
|
||||
&& usermod -aG dialout,plugdev $USERNAME \
|
||||
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME \
|
||||
&& chmod 0440 /etc/sudoers.d/$USERNAME
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"name": "ESPHome NUT UPS Development",
|
||||
"image": "ghcr.io/esphome/esphome:latest",
|
||||
"name": "ESPHome Component Development",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/git:1": {},
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {},
|
||||
@@ -21,7 +23,7 @@
|
||||
"--device=/dev/bus/usb:/dev/bus/usb:rwm"
|
||||
],
|
||||
"workspaceFolder": "/workspace",
|
||||
"postCreateCommand": "bash .devcontainer/setup.sh",
|
||||
"postCreateCommand": "sudo bash .devcontainer/setup.sh",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
@@ -72,7 +74,7 @@
|
||||
"PLATFORMIO_CORE_DIR": "/workspace/.platformio"
|
||||
},
|
||||
"init": true,
|
||||
"remoteUser": "root",
|
||||
"remoteUser": "esphome",
|
||||
"capAdd": [
|
||||
"SYS_RAWIO",
|
||||
"SYS_ADMIN"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Setting up ESPHome NUT UPS Development Environment..."
|
||||
echo "🚀 Setting up ESPHome Component Development Environment..."
|
||||
|
||||
# Update and install packages
|
||||
apt-get update
|
||||
@@ -15,13 +15,15 @@ pip install --upgrade pip black flake8 pylint mypy pytest jupyter ipython platfo
|
||||
# Update ESPHome
|
||||
pip install --upgrade esphome
|
||||
|
||||
# Claude Code - MCP server
|
||||
claude mcp add code npx "@steipete/claude-code-mcp" "/workspace"
|
||||
|
||||
# Set up USB permissions
|
||||
cat > /etc/udev/rules.d/99-esphome-usb.rules << 'UDEV_EOF'
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="303a", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="10c4", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="1a86", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="0001", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="0463", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="050d", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="051d", MODE="0666"
|
||||
@@ -46,15 +48,17 @@ alias serialports='ls -la /dev/tty{USB,ACM}* 2>/dev/null || echo "No serial port
|
||||
alias build-component='cd /workspace && esphome compile full-test.yaml'
|
||||
alias flash-test='cd /workspace && esphome upload full-test.yaml'
|
||||
alias monitor='cd /workspace && esphome logs full-test.yaml'
|
||||
alias dclaude='claude --dangerously-skip-permissions'
|
||||
BASH_EOF
|
||||
|
||||
# Welcome message
|
||||
cat > /tmp/WELCOME.md << 'WELCOME_EOF'
|
||||
# 🎉 ESPHome NUT UPS Development Environment Ready!
|
||||
# 🎉 ESPHome Component Development Environment Ready!
|
||||
|
||||
## Quick Commands
|
||||
- `esphome-dashboard` - Start web dashboard
|
||||
- `./tools/scan-usb.sh` - Check USB devices
|
||||
- `./tools/generate_vendor_list.py` - Generate UPS Vendor List
|
||||
- `build-component` - Build test config
|
||||
- `flash-test` - Flash to device
|
||||
- `monitor` - View logs
|
||||
@@ -62,5 +66,5 @@ cat > /tmp/WELCOME.md << 'WELCOME_EOF'
|
||||
Happy coding! 🚀
|
||||
WELCOME_EOF
|
||||
|
||||
echo "✅ Development environment setup complete!"
|
||||
echo "✅ Development environment setup complete!\n\n"
|
||||
cat /tmp/WELCOME.md
|
||||
Reference in new issue
Block a user