Skip to content

Commit 62e5d4d

Browse files
committed
feat: add devcontainer configuration for consistent development environment
- Add Dockerfile with Node 20.19.2 and pnpm 10.8.1 - Configure devcontainer.json with VS Code extensions - Set up pnpm cache mounts for better performance - Add postCreateCommand for automatic dependency installation - Include GitHub CLI and Git features Closes #8978
1 parent ca10cba commit 62e5d4d

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Use the official Node.js image as base
2+
FROM node:20.19.2-bookworm-slim
3+
4+
# Install basic development tools
5+
RUN apt-get update && apt-get install -y \
6+
git \
7+
curl \
8+
wget \
9+
ca-certificates \
10+
gnupg \
11+
lsb-release \
12+
# Clean up apt cache to reduce image size
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
# Install pnpm globally with the exact version from package.json
16+
RUN corepack enable && corepack prepare [email protected] --activate
17+
18+
# Set pnpm store directory for better caching
19+
ENV PNPM_HOME="/pnpm"
20+
ENV PATH="$PNPM_HOME:$PATH"
21+
22+
# Create a non-root user for development
23+
ARG USERNAME=node
24+
ARG USER_UID=1000
25+
ARG USER_GID=$USER_UID
26+
27+
# Ensure the node user has the correct UID/GID
28+
RUN groupmod --gid $USER_GID $USERNAME \
29+
&& usermod --uid $USER_UID --gid $USER_GID $USERNAME \
30+
&& chown -R $USER_UID:$USER_GID /home/$USERNAME
31+
32+
# Create pnpm directories with correct permissions
33+
RUN mkdir -p /pnpm /workspace \
34+
&& chown -R $USERNAME:$USERNAME /pnpm /workspace
35+
36+
# Switch to non-root user
37+
USER $USERNAME
38+
39+
# Set the working directory
40+
WORKDIR /workspace

.devcontainer/devcontainer.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"name": "Roo Code Dev Container",
3+
"dockerFile": "Dockerfile",
4+
5+
// Features to add to the dev container
6+
"features": {
7+
"ghcr.io/devcontainers/features/git:1": {},
8+
"ghcr.io/devcontainers/features/github-cli:1": {}
9+
},
10+
11+
// Configure tool-specific properties
12+
"customizations": {
13+
"vscode": {
14+
// Add the extensions from .vscode/extensions.json
15+
"extensions": [
16+
"dbaeumer.vscode-eslint",
17+
"esbenp.prettier-vscode",
18+
"csstools.postcss",
19+
"bradlc.vscode-tailwindcss",
20+
"connor4312.esbuild-problem-matchers",
21+
"yoavbls.pretty-ts-errors"
22+
],
23+
"settings": {
24+
"terminal.integrated.defaultProfile.linux": "bash",
25+
"terminal.integrated.profiles.linux": {
26+
"bash": {
27+
"path": "/bin/bash",
28+
"icon": "terminal-bash"
29+
}
30+
},
31+
"editor.formatOnSave": true,
32+
"editor.defaultFormatter": "esbenp.prettier-vscode",
33+
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
34+
"typescript.tsdk": "node_modules/typescript/lib"
35+
}
36+
}
37+
},
38+
39+
// Use 'forwardPorts' to make a list of ports inside the container available locally
40+
"forwardPorts": [],
41+
42+
// Use 'postCreateCommand' to run commands after the container is created
43+
"postCreateCommand": "pnpm install --frozen-lockfile",
44+
45+
// Use 'postStartCommand' to run commands after the container starts
46+
"postStartCommand": "echo '🎉 Dev container is ready!'",
47+
48+
// Configure mounts for better performance and caching
49+
"mounts": [
50+
// Mount pnpm store as a volume for caching
51+
"source=pnpm-store,target=/pnpm,type=volume",
52+
// Mount node_modules as volumes for better performance
53+
"source=node-modules,target=/workspace/node_modules,type=volume",
54+
"source=src-node-modules,target=/workspace/src/node_modules,type=volume",
55+
"source=webview-ui-node-modules,target=/workspace/webview-ui/node_modules,type=volume"
56+
],
57+
58+
// Environment variables
59+
"containerEnv": {
60+
"PNPM_HOME": "/pnpm",
61+
"PATH": "/pnpm:${localEnv:PATH}"
62+
},
63+
64+
// Run as non-root user
65+
"remoteUser": "node",
66+
67+
// Uncomment to connect as root instead
68+
// "remoteUser": "root",
69+
70+
// Additional options
71+
"updateRemoteUserUID": true,
72+
"shutdownAction": "stopContainer"
73+
}

0 commit comments

Comments
 (0)