Skip to content

Commit 5272bd1

Browse files
pandemicsynpandemicsyn
andauthored
Adds basic kilocode cli Docker image (#3332)
* Adds basic kilocode cli Docker & supporting docs * Tiny bit of clean up --------- Co-authored-by: pandemicsyn <[email protected]>
1 parent 48ffd31 commit 5272bd1

File tree

3 files changed

+302
-0
lines changed

3 files changed

+302
-0
lines changed

cli/.dockerignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
pnpm-debug.log*
7+
8+
# Build outputs
9+
dist/
10+
build/
11+
.turbo/
12+
*.tsbuildinfo
13+
14+
# Testing
15+
coverage/
16+
.nyc_output/
17+
__tests__/
18+
*.spec.ts
19+
*.test.ts
20+
*.spec.tsx
21+
*.test.tsx
22+
23+
# Development files
24+
.env
25+
.env.local
26+
.env.*.local
27+
*.log
28+
logs/
29+
30+
# IDE and editor files
31+
.vscode/
32+
.idea/
33+
*.swp
34+
*.swo
35+
*~
36+
.DS_Store
37+
38+
# Git
39+
.git/
40+
.gitignore
41+
.gitattributes
42+
43+
# CI/CD
44+
.github/
45+
.gitlab-ci.yml
46+
.travis.yml
47+
48+
# Documentation (keep README.md)
49+
docs/
50+
*.md
51+
!README.md
52+
53+
# Config files
54+
.prettierrc*
55+
.eslintrc*
56+
.editorconfig
57+
tsconfig.json
58+
vitest.config.ts
59+
vitest.setup.ts
60+
eslint.config.mjs
61+
esbuild.config.mjs
62+
63+
# Misc
64+
*.orig
65+
*.rej
66+
.changeset/

cli/Dockerfile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Kilo Code CLI Docker Image
2+
FROM node:20.19.2-bookworm-slim
3+
4+
# Build arguments for metadata (all optional with defaults)
5+
ARG BUILD_DATE=""
6+
ARG VCS_REF=""
7+
ARG VERSION="latest"
8+
9+
# OCI Image labels
10+
LABEL org.opencontainers.image.created="${BUILD_DATE}"
11+
LABEL org.opencontainers.image.revision="${VCS_REF}"
12+
LABEL org.opencontainers.image.version="${VERSION}"
13+
LABEL org.opencontainers.image.title="Kilo Code CLI"
14+
LABEL org.opencontainers.image.description="Docker image for Kilo Code CLI with Chromium support"
15+
LABEL org.opencontainers.image.vendor="Kilo Code"
16+
LABEL org.opencontainers.image.url="https://kilocode.ai/docs/cli"
17+
LABEL org.opencontainers.image.documentation="https://kilocode.ai/docs/cli"
18+
LABEL org.opencontainers.image.source="https://github.com/Kilo-Org/kilocode"
19+
LABEL org.opencontainers.image.licenses="Apache-2.0"
20+
21+
# Install system dependencies and clean up in one layer
22+
RUN apt-get update && apt-get install -y \
23+
python3 \
24+
make \
25+
g++ \
26+
# Chromium and dependencies for puppeteer
27+
chromium \
28+
chromium-sandbox \
29+
fonts-liberation \
30+
fonts-noto-color-emoji \
31+
libnss3 \
32+
libnspr4 \
33+
libatk1.0-0 \
34+
libatk-bridge2.0-0 \
35+
libcups2 \
36+
libdrm2 \
37+
libxkbcommon0 \
38+
libxcomposite1 \
39+
libxdamage1 \
40+
libxfixes3 \
41+
libxrandr2 \
42+
libgbm1 \
43+
libasound2 \
44+
git \
45+
ca-certificates \
46+
&& apt-get clean \
47+
&& rm -rf /var/lib/apt/lists/*
48+
49+
RUN npm install -g @kilocode/cli@latest
50+
51+
# Set environment variables for Chromium
52+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
53+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
54+
CHROME_PATH=/usr/bin/chromium \
55+
CHROME_BIN=/usr/bin/chromium
56+
57+
# Set home directory
58+
ENV HOME=/home/kilocode
59+
60+
# Create non-root user and set up directories in one layer
61+
RUN groupadd -r kilocode && useradd -r -g kilocode -G audio,video kilocode \
62+
&& mkdir -p /home/kilocode/.kilocode /workspace \
63+
&& chown -R kilocode:kilocode /home/kilocode /workspace
64+
65+
# Set working directory
66+
WORKDIR /workspace
67+
68+
# Switch to non-root user
69+
USER kilocode
70+
71+
# Use ENTRYPOINT so arguments are properly passed to the CLI
72+
ENTRYPOINT ["/usr/local/bin/kilocode"]
73+
74+
# Default to interactive mode if no args provided
75+
CMD []

cli/docs/DOCKER.md

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Kilo Code CLI - Docker Guide
2+
3+
A containerized version of the Kilo Code CLI with full browser automation support.
4+
5+
## Quick Start Examples
6+
7+
### Build the Image
8+
9+
**Basic build** (no metadata required):
10+
11+
```bash
12+
cd cli
13+
docker build -t kilocode/cli .
14+
```
15+
16+
**With build metadata** (optional, for production/CI):
17+
18+
```bash
19+
docker build \
20+
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
21+
--build-arg VCS_REF=$(git rev-parse --short HEAD) \
22+
--build-arg VERSION=$(jq -r '.version' package.json) \
23+
-t kilocode/cli:$(jq -r '.version' package.json) \
24+
-t kilocode/cli:latest \
25+
.
26+
```
27+
28+
The build arguments are all optional and have defaults:
29+
30+
- `BUILD_DATE` - defaults to empty string
31+
- `VCS_REF` - defaults to empty string
32+
- `VERSION` - defaults to "latest"
33+
34+
### 1. Basic Interactive Mode
35+
36+
Run the CLI interactively in your current directory:
37+
38+
```bash
39+
docker run -it --rm -v $(pwd):/workspace kilocode/cli
40+
```
41+
42+
### 2. Architect Mode
43+
44+
Start in architect mode for planning and design:
45+
46+
```bash
47+
docker run -it --rm -v $(pwd):/workspace kilocode/cli --mode architect
48+
```
49+
50+
### 3. One-Shot Autonomous Mode
51+
52+
Execute a single task and exit automatically:
53+
54+
```bash
55+
docker run --rm -v $(pwd):/workspace kilocode/cli --auto "Run tests and fix any issues"
56+
```
57+
58+
### 4. With Local Configuration
59+
60+
Mount your existing Kilo Code configuration to avoid setup prompts:
61+
62+
```bash
63+
docker run -it --rm \
64+
-v $(pwd):/workspace \
65+
-v ~/.kilocode:/home/kilocode/.kilocode \
66+
kilocode/cli
67+
```
68+
69+
---
70+
71+
## Additional Options
72+
73+
### Custom Workspace Path
74+
75+
```bash
76+
docker run -it --rm -v /path/to/project:/workspace kilocode/cli
77+
```
78+
79+
### Mount Git Configuration
80+
81+
For commit operations:
82+
83+
```bash
84+
docker run -it --rm \
85+
-v $(pwd):/workspace \
86+
-v ~/.kilocode:/home/kilocode/.kilocode \
87+
-v ~/.gitconfig:/home/kilocode/.gitconfig:ro \
88+
kilocode/cli
89+
```
90+
91+
### Environment Variables
92+
93+
```bash
94+
docker run -it --rm \
95+
-v $(pwd):/workspace \
96+
-e KILOCODE_MODE=code \
97+
kilocode/cli
98+
```
99+
100+
### With Timeout
101+
102+
```bash
103+
docker run --rm \
104+
-v $(pwd):/workspace \
105+
kilocode/cli /usr/local/bin/kilocode --timeout 300 --auto "Run tests"
106+
```
107+
108+
## Configuration
109+
110+
### Persistent Configuration
111+
112+
The CLI stores configuration in `~/.kilocode/config.json`. You can:
113+
114+
**Option 1: Mount local config** (recommended)
115+
116+
```bash
117+
-v ~/.kilocode:/home/kilocode/.kilocode
118+
```
119+
120+
**Option 2: Use Docker volume for isolated config**
121+
122+
```bash
123+
docker volume create kilocode-config
124+
docker run -it --rm \
125+
-v $(pwd):/workspace \
126+
-v kilocode-config:/home/kilocode/.kilocode \
127+
kilocode/cli
128+
```
129+
130+
### Terminal Colors and Theme
131+
132+
If you experience text visibility issues (text blending with background), you can:
133+
134+
**Option 1: Set theme explicitly in config**
135+
136+
Edit `~/.kilocode/config.json`:
137+
138+
```json
139+
{
140+
"theme": "dark" // or "light" for light terminals
141+
}
142+
```
143+
144+
**Option 2: Force color environment variables**
145+
146+
```bash
147+
docker run -it --rm \
148+
-v $(pwd):/workspace \
149+
-e FORCE_COLOR=1 \
150+
-e COLORTERM=truecolor \
151+
kilocode/cli
152+
```
153+
154+
**Option 3: Pass terminal info**
155+
156+
```bash
157+
docker run -it --rm \
158+
-v $(pwd):/workspace \
159+
-e TERM=$TERM \
160+
kilocode/cli
161+
```

0 commit comments

Comments
 (0)