This directory contains the devcontainer configuration for the Langstar project. The devcontainer provides a consistent development environment across local machines and GitHub Codespaces using Docker Compose.
First-time contributor? See docs/dev/getting-started.md for step-by-step setup instructions for VS Code, JetBrains, and Codespaces.
The devcontainer uses Docker Compose which provides native .env file support, solving environment variable management elegantly for both local and Codespaces environments.
- Local Development: Docker Compose automatically loads
.envfile - GitHub Codespaces: Environment variables come from Codespaces secrets
- Single Configuration: No duplication, standard Docker Compose patterns
- Docker Desktop installed and running
- VS Code with the Dev Containers extension installed
-
Copy environment template:
cd .devcontainer cp .env.default .env -
Edit
.envwith your actual credentials:# Replace placeholder values with real credentials GITHUB_PAT=ghp_YourActualTokenHere GITHUB_USER=your_github_username GITHUB_PROJECT_PAT=ghp_YourProjectTokenHere AWS_ACCESS_KEY_ID=your_aws_access_key_here AWS_SECRET_ACCESS_KEY=your_aws_secret_key_here LANGSMITH_API_KEY=lsv2_YourActualKeyHere -
(Optional) Create local overrides:
cp docker-compose.override.yml.template docker-compose.override.yml # Edit docker-compose.override.yml for local customizations -
Open in devcontainer:
- Open the project in VS Code
- Press
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Select "Dev Containers: Reopen in Container"
- Wait for the container to build (first time takes a few minutes)
By default, this devcontainer uses a bind mount (..:/workspace:cached) for maximum compatibility with VS Code, JetBrains, and GitHub Codespaces.
Default behavior:
- Your local repository files are mounted directly into the container
- Changes sync bidirectionally between host and container
- Standard "Reopen in Container" workflow works seamlessly
If you're using RustRover, IntelliJ, or other JetBrains IDEs and see the warning:
"External file changes sync might be slow"
This occurs because Docker's bind mount on macOS uses gRPC FUSE, which doesn't provide full inotify support.
To fix this, you can switch to a named Docker volume by editing docker-compose.override.yml:
- Copy the template:
cp docker-compose.override.yml.template docker-compose.override.yml - Uncomment the volumes section for named volume
- Rebuild the container
- Clone the repo inside the container:
cd /workspace && git clone <repo-url> .
Trade-offs of named volume:
| Aspect | Bind Mount (default) | Named Volume (optional) |
|---|---|---|
| File watching | Limited (gRPC FUSE) | Full inotify support |
| File location | Host filesystem | Container volume |
| Setup workflow | Standard | Requires clone into container |
| Host editing | Supported | Not supported |
See docker-compose.override.yml.template for detailed instructions.
These files are created locally and will not be committed to git:
.devcontainer/.env- Your local environment variables with secrets.devcontainer/docker-compose.override.yml- Optional local Docker Compose overrides
Codespaces uses repository or organization secrets instead of local .env files.
-
Go to your repository settings:
- Navigate to
Settings→Secrets and variables→Codespaces
- Navigate to
-
Add the following secrets:
Secret Name Description Example Value GH_PATGitHub Personal Access Token ghp_xxxxxGH_USERYour GitHub username your_usernameGH_PROJECT_PATGitHub PAT with project permissions ghp_xxxxxAWS_ACCESS_KEY_IDAWS access key for Bedrock AKIAXXXXXXXAWS_SECRET_ACCESS_KEYAWS secret access key xxxxxLANGSMITH_API_KEYLangSmith API key lsv2_xxxxx -
Create a Codespace:
- Go to the repository on GitHub
- Click the green "Code" button
- Select "Codespaces" tab
- Click "Create codespace on main" (or your branch)
In Codespaces:
- The
devcontainer.jsonuses Docker Compose configuration docker-compose.ymluses fallback syntax:${GITHUB_PAT:-${GH_PAT}}- Environment variables come from Codespaces secrets (
GH_PAT,GH_USER, etc.) - No
.envfile is needed or used setup-github-auth.shconfigures git authentication using the provided variables
| File | Purpose | Committed to Git | Environment |
|---|---|---|---|
devcontainer.json |
Dev Container config (points to Docker Compose) | ✅ Yes | Both |
docker-compose.yml |
Docker Compose service definition | ✅ Yes | Both |
docker-compose.override.yml.template |
Template for local Docker overrides | ✅ Yes | Both |
docker-compose.override.yml |
Local Docker Compose overrides | ❌ No (gitignored) | Local only |
.env.default |
Environment variables template | ✅ Yes | Both |
.env |
Actual environment variables | ❌ No (gitignored) | Local only |
Dockerfile |
Container image definition | ✅ Yes | Both |
setup-github-auth.sh |
Git authentication setup | ✅ Yes | Both |
Docker Compose has native .env file support:
-
Local Development:
- Docker Compose automatically loads
.envfrom the same directory asdocker-compose.yml - Variables are substituted in
docker-compose.ymlusing${VARIABLE_NAME}syntax - Variables become available in the container environment
- No custom scripts or workarounds needed!
- Docker Compose automatically loads
-
GitHub Codespaces:
- Codespaces secrets are available as environment variables to Docker Compose
docker-compose.ymluses fallback syntax:${GITHUB_PAT:-${GH_PAT}}- This means: use
GITHUB_PATif available, otherwise useGH_PAT - Works seamlessly without any
.envfile
-
Variable Precedence:
- Local:
.envfile variables → Docker Compose → Container environment - Codespaces: Secrets → Docker Compose → Container environment
- Local:
docker-compose.yml (base configuration, committed):
services:
langstar-dev:
build:
context: .
dockerfile: Dockerfile
environment:
# Supports both local (.env) and Codespaces (secrets)
GITHUB_PAT: ${GITHUB_PAT:-${GH_PAT}}
GITHUB_USER: ${GITHUB_USER:-${GH_USER}}
# ... other variables
volumes:
# Bind mount for compatibility with VS Code, JetBrains, and Codespaces
- ..:/workspace:cached
- claude-code-bashhistory:/commandhistory
- claude-code-config:/home/node/.claude
volumes:
claude-code-bashhistory:
claude-code-config:docker-compose.override.yml (local only, gitignored):
services:
langstar-dev:
# Add local-specific customizations
ports:
- "8080:8080" # Example: expose ports
volumes:
- ~/my-data:/data # Example: mount local directoriesProblem: Container fails to build
Local Development:
- Verify Docker Desktop is running
- Check
.envfile exists and has actual values (not placeholders) - Try:
docker-compose -f .devcontainer/docker-compose.yml build --no-cache
Codespaces:
- Ensure Codespaces secrets are configured correctly
- Verify secret names match exactly:
GH_PAT,GH_USER, etc. - Check secrets have proper permissions
Problem: Environment variables are undefined in the container
Local Development:
- Verify
.devcontainer/.envexists and has actual values - Check you're in
.devcontainerdirectory when running Docker Compose - Rebuild:
Dev Containers: Rebuild Container - Test manually:
cd .devcontainer docker-compose config # Shows merged configuration
Codespaces:
- Check Codespaces secrets in repository settings
- Restart the Codespace
- Verify:
printenv | grep -E 'GH_|ANTHROPIC|LANGSMITH'
Problem: Git operations fail with authentication errors
Solution:
- Check that
GITHUB_PAT(local) orGH_PAT(Codespaces) is set correctly - Verify the token has
reposcope - Run setup script manually:
bash .devcontainer/setup-github-auth.sh - Check token in container:
echo ${GITHUB_PAT:-${GH_PAT}} | cut -c1-10 # Show first 10 chars
Problem: Local overrides in docker-compose.override.yml aren't applied
Solution:
- Ensure file is named exactly
docker-compose.override.yml(not.template) - Verify it's in
.devcontainer/directory - Check YAML syntax is valid:
docker-compose config - Rebuild container completely
-
Never commit secrets:
- Always use
.envor Codespaces secrets - Never hardcode credentials in configuration files
- Double-check
.gitignoreincludes.envanddocker-compose.override.yml
- Always use
-
Keep templates updated:
- Update
.env.defaultwhen adding new environment variables - Update
docker-compose.override.yml.templatewhen changing Docker config - Document any new required secrets
- Update
-
Test both environments:
- Test configuration changes locally before committing
- Verify changes work in Codespaces (create a test Codespace)
- Ensure new environment variables are documented
-
Use Docker Compose features:
- Use
docker-compose.override.ymlfor local customizations - Leverage Docker Compose's native
.envfile support - Follow Docker Compose best practices
- Use
| Variable | Local Name | Codespaces Name | Required | Description |
|---|---|---|---|---|
| GitHub PAT | GITHUB_PAT |
GH_PAT |
Yes | Personal access token for git operations |
| GitHub User | GITHUB_USER |
GH_USER |
Yes | Your GitHub username |
| GitHub Project PAT | GITHUB_PROJECT_PAT |
GH_PROJECT_PAT |
Optional | PAT with project permissions for manual project status updates via Claude skill |
| Variable | Required | Description |
|---|---|---|
AWS_ACCESS_KEY_ID |
Yes | AWS access key for Bedrock authentication |
AWS_SECRET_ACCESS_KEY |
Yes | AWS secret access key for Bedrock authentication |
LANGSMITH_API_KEY |
Optional | LangSmith API key for testing |
| Variable | Required | Default | Description |
|---|---|---|---|
ANTHROPIC_MODEL |
No | us.anthropic.claude-sonnet-4-5-20250929-v1:0 |
Primary Claude model |
ANTHROPIC_SMALL_FAST_MODEL |
No | us.anthropic.claude-haiku-4-5-20251001-v1:0 |
Fast model for simple tasks |
AWS_REGION |
No | us-east-1 |
AWS region for Bedrock |
CLAUDE_CODE_USE_BEDROCK |
No | 1 |
Use Bedrock for Claude |
# View merged Docker Compose configuration
cd .devcontainer
docker-compose config
# Build without cache
docker-compose build --no-cache
# View container logs
docker-compose logs langstar-dev
# Execute command in running container
docker-compose exec langstar-dev bash# Inside container - check all environment variables
printenv | sort
# Check specific variable
echo $GITHUB_PAT | cut -c1-20 # Show first 20 chars
# Test Docker Compose variable substitution
cd .devcontainer
docker-compose config | grep -A 10 environment: