Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dad283e

Browse files
author
tuxudong
committed
init coder-docker
1 parent a9850ee commit dad283e

File tree

10 files changed

+749
-251
lines changed

10 files changed

+749
-251
lines changed

‎.dockerignore‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.git
2+
.gitignore
3+
.DS_Store
4+
node_modules
5+
__pycache__
6+
*.pyc
7+
.pytest_cache
8+
.venv
9+
venv
10+
*.egg-info
11+
dist
12+
build
13+
.env
14+
.env.local
15+
README.md
16+
.github
17+
.editorconfig
18+
.prettierrc
19+
.eslintrc
20+
package-lock.json
21+
yarn.lock
22+
pnpm-lock.yaml

‎.env.example‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ============================================
2+
# Docker Compose 环境变量
3+
# ============================================
4+
# 复制为 .env 后填入你的密钥
5+
6+
# OpenAI
7+
OPENAI_API_KEY=sk-proj-your-key-here
8+
OPENAI_ORG_ID=org-your-org-id-here
9+
10+
# Anthropic
11+
ANTHROPIC_API_KEY=sk-ant-your-key-here
12+
13+
# Google
14+
GEMINI_API_KEY=your-gemini-key-here
15+
16+
# GitHub
17+
GITHUB_TOKEN=ghp_your-token-here
18+
19+
# Sourcegraph
20+
SRC_ACCESS_TOKEN=sgp_your-token-here

‎Dockerfile‎

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
FROM node:20-slim
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
ENV TERM=xterm-256color
5+
ENV PATH="/home/coder/.local/bin:${PATH}"
6+
7+
WORKDIR /workspace
8+
9+
# Install system dependencies in one layer
10+
RUN apt-get update && apt-get install -y \
11+
git \
12+
curl \
13+
wget \
14+
ca-certificates \
15+
python3 \
16+
python3-pip \
17+
python3-venv \
18+
pipx \
19+
build-essential \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
# Upgrade npm to latest version
23+
RUN npm install -g npm@latest
24+
25+
# Install npm-based AI coding tools
26+
RUN npm install -g \
27+
@anthropic-ai/claude-code \
28+
@continuedev/cli \
29+
@sourcegraph/cody \
30+
@githubnext/github-copilot-cli \
31+
@openai/codex \
32+
&& npm cache clean --force
33+
34+
# Create non-root user
35+
RUN useradd -m -s /bin/bash coder
36+
37+
# Switch to user and setup Python tools
38+
USER coder
39+
WORKDIR /home/coder
40+
41+
# Install Python-based tools via pipx
42+
RUN pipx install gpt-engineer && \
43+
pipx install aider-chat && \
44+
pipx install open-interpreter
45+
46+
# Create configuration directories
47+
RUN mkdir -p ~/.config/ai-tools ~/.cache ~/projects
48+
49+
# Create configuration template using echo
50+
RUN echo '# AI Tools Configuration Template' > ~/.config/ai-tools/config.env.template && \
51+
echo '# Copy this file to config.env and fill in your API keys' >> ~/.config/ai-tools/config.env.template && \
52+
echo '' >> ~/.config/ai-tools/config.env.template && \
53+
echo '# OpenAI Configuration' >> ~/.config/ai-tools/config.env.template && \
54+
echo 'OPENAI_API_KEY="your-openai-key-here"' >> ~/.config/ai-tools/config.env.template && \
55+
echo 'OPENAI_ORG_ID="your-org-id-here"' >> ~/.config/ai-tools/config.env.template && \
56+
echo '' >> ~/.config/ai-tools/config.env.template && \
57+
echo '# Anthropic Claude Configuration' >> ~/.config/ai-tools/config.env.template && \
58+
echo 'ANTHROPIC_API_KEY="your-anthropic-key-here"' >> ~/.config/ai-tools/config.env.template && \
59+
echo '' >> ~/.config/ai-tools/config.env.template && \
60+
echo '# Google Gemini Configuration' >> ~/.config/ai-tools/config.env.template && \
61+
echo 'GEMINI_API_KEY="your-gemini-key-here"' >> ~/.config/ai-tools/config.env.template && \
62+
echo '' >> ~/.config/ai-tools/config.env.template && \
63+
echo '# GitHub Copilot Configuration' >> ~/.config/ai-tools/config.env.template && \
64+
echo 'GITHUB_TOKEN="your-github-token-here"' >> ~/.config/ai-tools/config.env.template && \
65+
echo '' >> ~/.config/ai-tools/config.env.template && \
66+
echo '# Sourcegraph Cody Configuration' >> ~/.config/ai-tools/config.env.template && \
67+
echo 'SRC_ACCESS_TOKEN="your-sourcegraph-token-here"' >> ~/.config/ai-tools/config.env.template && \
68+
echo 'SRC_ENDPOINT="https://sourcegraph.com"' >> ~/.config/ai-tools/config.env.template
69+
70+
# Create helper script using echo
71+
RUN echo '#!/bin/bash' > ~/list-agents.sh && \
72+
echo 'echo ""' >> ~/list-agents.sh && \
73+
echo 'echo "🚀 AI Coding Agents Collection"' >> ~/list-agents.sh && \
74+
echo 'echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"' >> ~/list-agents.sh && \
75+
echo 'echo ""' >> ~/list-agents.sh && \
76+
echo 'echo "📦 Installed Tools:"' >> ~/list-agents.sh && \
77+
echo 'echo ""' >> ~/list-agents.sh && \
78+
echo 'echo " npm-based CLI tools:"' >> ~/list-agents.sh && \
79+
echo 'echo " • claude - Anthropic Claude Code"' >> ~/list-agents.sh && \
80+
echo 'echo " • cn - Continue CLI"' >> ~/list-agents.sh && \
81+
echo 'echo " • cody - Sourcegraph Cody"' >> ~/list-agents.sh && \
82+
echo 'echo " • github-copilot - GitHub Copilot CLI"' >> ~/list-agents.sh && \
83+
echo 'echo " • codex - OpenAI Codex CLI"' >> ~/list-agents.sh && \
84+
echo 'echo ""' >> ~/list-agents.sh && \
85+
echo 'echo " Python tools (via pipx):"' >> ~/list-agents.sh && \
86+
echo 'echo " • gpt-engineer - GPT Engineer"' >> ~/list-agents.sh && \
87+
echo 'echo " • aider - Aider Chat"' >> ~/list-agents.sh && \
88+
echo 'echo " • interpreter - Open Interpreter"' >> ~/list-agents.sh && \
89+
echo 'echo ""' >> ~/list-agents.sh && \
90+
echo 'echo "📁 Volume Mounts:"' >> ~/list-agents.sh && \
91+
echo 'echo " • ~/projects - Your project files"' >> ~/list-agents.sh && \
92+
echo 'echo " • ~/.config - Configuration files"' >> ~/list-agents.sh && \
93+
echo 'echo " • ~/.cache - Cache directory"' >> ~/list-agents.sh && \
94+
echo 'echo ""' >> ~/list-agents.sh && \
95+
echo 'echo "⚙️ Configuration:"' >> ~/list-agents.sh && \
96+
echo 'if [ -f ~/.config/ai-tools/config.env ]; then' >> ~/list-agents.sh && \
97+
echo ' set -a' >> ~/list-agents.sh && \
98+
echo ' source ~/.config/ai-tools/config.env' >> ~/list-agents.sh && \
99+
echo ' set +a' >> ~/list-agents.sh && \
100+
echo ' echo " ✅ Config loaded from ~/.config/ai-tools/config.env"' >> ~/list-agents.sh && \
101+
echo ' [ -n "$OPENAI_API_KEY" ] && echo " ✓ OpenAI API Key"' >> ~/list-agents.sh && \
102+
echo ' [ -n "$ANTHROPIC_API_KEY" ] && echo " ✓ Anthropic API Key"' >> ~/list-agents.sh && \
103+
echo ' [ -n "$GEMINI_API_KEY" ] && echo " ✓ Gemini API Key"' >> ~/list-agents.sh && \
104+
echo ' [ -n "$GITHUB_TOKEN" ] && echo " ✓ GitHub Token"' >> ~/list-agents.sh && \
105+
echo 'else' >> ~/list-agents.sh && \
106+
echo ' echo " ⚠️ No config found"' >> ~/list-agents.sh && \
107+
echo ' echo " Copy: ~/.config/ai-tools/config.env.template"' >> ~/list-agents.sh && \
108+
echo ' echo " To: ~/.config/ai-tools/config.env"' >> ~/list-agents.sh && \
109+
echo 'fi' >> ~/list-agents.sh && \
110+
echo 'echo ""' >> ~/list-agents.sh && \
111+
echo 'echo "💡 Quick Start:"' >> ~/list-agents.sh && \
112+
echo 'echo " 1. cd ~/projects"' >> ~/list-agents.sh && \
113+
echo 'echo " 2. Run any tool: claude, aider, codex, etc."' >> ~/list-agents.sh && \
114+
echo 'echo ""' >> ~/list-agents.sh && \
115+
chmod +x ~/list-agents.sh
116+
117+
# Auto-load config on shell startup
118+
RUN echo '' >> ~/.bashrc && \
119+
echo '# Auto-load AI tools configuration' >> ~/.bashrc && \
120+
echo 'if [ -f ~/.config/ai-tools/config.env ]; then' >> ~/.bashrc && \
121+
echo ' set -a' >> ~/.bashrc && \
122+
echo ' source ~/.config/ai-tools/config.env' >> ~/.bashrc && \
123+
echo ' set +a' >> ~/.bashrc && \
124+
echo 'fi' >> ~/.bashrc
125+
126+
VOLUME ["/home/coder/projects", "/home/coder/.config", "/home/coder/.cache"]
127+
128+
CMD ["/bin/bash", "-c", "~/list-agents.sh && exec /bin/bash"]

‎Makefile‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.PHONY: help build up down logs shell clean restart
2+
3+
help:
4+
@echo "🚀 AI Coding Agents - 快速命令"
5+
@echo "================================"
6+
@echo "make build - 构建 Docker 镜像"
7+
@echo "make up - 启动容器"
8+
@echo "make down - 停止容器"
9+
@echo "make shell - 进入容器 shell"
10+
@echo "make logs - 查看容器日志"
11+
@echo "make clean - 清理容器和卷"
12+
@echo "make restart - 重启容器"
13+
@echo "make setup - 初始化设置"
14+
15+
build:
16+
DOCKER_BUILDKIT=1 docker-compose build
17+
18+
up:
19+
docker-compose up -it
20+
21+
down:
22+
docker-compose down
23+
24+
shell:
25+
docker-compose exec ai-coding-agents /bin/bash
26+
27+
logs:
28+
docker-compose logs -f
29+
30+
clean:
31+
docker-compose down -v
32+
docker system prune -a
33+
34+
restart:
35+
docker-compose restart
36+
37+
setup:
38+
chmod +x setup.sh
39+
./setup.sh
40+
41+
# 工具相关命令
42+
claude:
43+
docker-compose exec ai-coding-agents claude
44+
45+
aider:
46+
docker-compose exec ai-coding-agents aider
47+
48+
codex:
49+
docker-compose exec ai-coding-agents codex
50+
51+
gpt-engineer:
52+
docker-compose exec ai-coding-agents gpt-engineer
53+
54+
interpreter:
55+
docker-compose exec ai-coding-agents interpreter

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /