Improve devcontainer configuration

- Simplify Dockerfile: use golang:1.24 base, install Node via features
- Add proper port forwarding for Pulse (7655 frontend, 7656 API)
- Add Vue Volar extension for frontend development
- Add start-pulse-dev.sh helper script for auto-starting dev server
- Add FRONTEND_DEV_HOST to containerEnv for proper binding
- Add .env.devcontainer to .gitignore (local override file)
- Update frontend dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rcourtman
2026-01-01 19:42:01 +00:00
parent 3ea837c727
commit cb99673b7c
6 changed files with 55 additions and 49 deletions

View File

@@ -1,17 +1,17 @@
FROM golang:1.24-bookworm
FROM golang:1.24
# Install Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs && npm install -g npm@latest
# Set bash as default shell for features
SHELL ["/bin/bash", "-c"]
# Install additional dev tools
RUN apt-get update && apt-get install -y git make docker.io curl vim && rm -rf /var/lib/apt/lists/*
# Install dev tools needed for hot-dev.sh
RUN apt-get update && apt-get install -y bash git make curl vim sudo lsof inotify-tools && rm -rf /var/lib/apt/lists/*
# Create non-root user
ARG USERNAME=vscode
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 && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && chmod 0440 /etc/sudoers.d/$USERNAME
RUN groupadd --gid $USER_GID $USERNAME && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && chmod 0440 /etc/sudoers.d/$USERNAME
# Set up Go environment for non-root user
ENV GOPATH=/go
@@ -21,7 +21,4 @@ RUN mkdir -p $GOPATH/pkg $GOPATH/bin && chown -R $USERNAME:$USERNAME $GOPATH
USER $USERNAME
WORKDIR /workspace
# Install common Go tools
RUN go install golang.org/x/tools/gopls@latest && go install github.com/go-delve/delve/cmd/dlv@latest
CMD ["/bin/bash"]

View File

@@ -4,12 +4,18 @@
"dockerfile": "Dockerfile",
"context": "."
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
}
},
"customizations": {
"vscode": {
"extensions": [
"golang.go",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"vue.volar"
],
"settings": {
"go.gopath": "/go",
@@ -17,7 +23,22 @@
}
}
},
"forwardPorts": [8080, 3000],
"postCreateCommand": "go version && node --version",
"forwardPorts": [7655, 7656],
"portsAttributes": {
"7655": {
"label": "Pulse Frontend",
"onAutoForward": "openBrowser"
},
"7656": {
"label": "Pulse Backend API",
"onAutoForward": "silent"
}
},
"containerEnv": {
"PULSE_DEV_API_HOST": "localhost",
"FRONTEND_DEV_HOST": "0.0.0.0",
"LAN_IP": "localhost"
},
"updateContentCommand": "sudo chown -R vscode:vscode /workspaces/pulse && cd frontend-modern && npm install",
"remoteUser": "vscode"
}

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Auto-start script for pulse dev environment
PIDFILE="/tmp/pulse-dev.pid"
LOGFILE="/tmp/pulse-dev.log"
# Check if already running
if [ -f "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") 2>/dev/null; then
echo "Pulse dev server already running (PID: $(cat $PIDFILE))"
exit 0
fi
# Start hot-dev.sh
cd /workspaces/pulse
nohup ./scripts/hot-dev.sh > "$LOGFILE" 2>&1 &
echo $! > "$PIDFILE"
echo "Pulse dev server starting... (PID: $(cat $PIDFILE))"
echo "Logs: tail -f $LOGFILE"
echo "Frontend will be available at http://localhost:7655"