Skip to content

Commit 0657096

Browse files
committed
feat(docker): add Claude Code integration to dev environment
Adds Anthropic's Claude Code CLI to the development container for AI-assisted coding. Users can run Claude in interactive mode or autonomous mode with proper API key setup.
1 parent 7eb0cc5 commit 0657096

4 files changed

Lines changed: 37 additions & 1 deletion

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ A modern Python project template with best practices for development and collabo
1010
- 🔍 Type checking with [mypy](https://github.com/python/mypy)
1111
- 🧪 Testing with [pytest](https://github.com/pytest-dev/pytest)
1212
- 🐳 Docker support for development and deployment
13+
- 🤖 Claude Code integration for AI-assisted development
1314
- 👷 CI/CD with GitHub Actions
1415

1516
## Python Version
@@ -109,6 +110,34 @@ This creates a container with:
109110
- Source code mounted (changes reflect immediately)
110111
- Development tools ready to use
111112
- Automatic UID/GID mapping for file permissions
113+
- Claude Code CLI for AI-assisted development
114+
115+
#### Using Claude Code in the Container
116+
117+
1. Set up your API key:
118+
```bash
119+
# Copy the environment template
120+
cp docker/template.env docker/.env
121+
122+
# Add your Anthropic API key to docker/.env
123+
echo "ANTHROPIC_API_KEY=your_api_key_here" >> docker/.env
124+
```
125+
126+
2. Start the development environment:
127+
```bash
128+
make dev-env
129+
```
130+
131+
3. Inside the container, use Claude Code:
132+
```bash
133+
# Interactive mode (asks for permission before each action)
134+
claude
135+
136+
# Autonomous mode (runs without permission prompts)
137+
claude --dangerously-skip-permissions
138+
```
139+
140+
**Note**: The `--dangerously-skip-permissions` flag allows Claude to work autonomously. Use with caution and always review changes before committing.
112141

113142
### Production Image
114143
```bash

docker/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.12-slim
22

3-
# Install Auxiliary Software
3+
# Install Auxiliary Software + Node.js for Claude Code
44
RUN apt-get update && apt-get install -y \
55
make \
66
apt-utils \
@@ -12,8 +12,13 @@ RUN apt-get update && apt-get install -y \
1212
graphviz \
1313
software-properties-common \
1414
vim \
15+
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
16+
&& apt-get install -y nodejs \
1517
&& rm -rf /var/lib/apt/lists/*
1618

19+
# Install Claude Code CLI
20+
RUN npm install -g @anthropic-ai/claude-code
21+
1722
WORKDIR /workspace
1823

1924
# Copy essential files for dependency resolution to temp location

docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
environment:
1111
EXAMPLE: ${EXAMPLE}
1212
EXAMPLE_SECRET: ${EXAMPLE_SECRET}
13+
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
1314
command: /bin/bash
1415
# Note: user mapping handled by Podman rootless automatically
1516
# Bind whole project directory for simplicity

docker/template.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ DEBUG=true
88
# Secrets (do not commit actual values)
99
API_KEY=
1010
DATABASE_URL=
11+
ANTHROPIC_API_KEY=
1112

1213
# Container runtime settings (optional)
1314
# UID=${UID} # Uncomment to use your system UID

0 commit comments

Comments
 (0)