Skip to content

Commit 857cff6

Browse files
Merge pull request #61 from stbenjam/docker
Add container image with marketplace pre-installed for CI
2 parents 68c69f7 + cd19f4f commit 857cff6

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,61 @@ $ git clone [email protected]:openshift-eng/ai-helpers.git
3232
$ ln -s ai-helpers ~/.cursor/commands/ai-helpers
3333
```
3434

35+
## Using the Docker Container
36+
37+
A container is available with Claude Code and all plugins pre-installed.
38+
39+
### Building the Container
40+
41+
```bash
42+
podman build -f images/Dockerfile -t ai-helpers .
43+
```
44+
45+
### Running with Vertex AI and gcloud Authentication
46+
47+
To use Claude Code with Google Cloud's Vertex AI, you need to pass through your gcloud credentials and set the required environment variables:
48+
49+
```bash
50+
podman run -it \
51+
-e CLAUDE_CODE_USE_VERTEX=1 \
52+
-e CLOUD_ML_REGION=your-ml-region \
53+
-e ANTHROPIC_VERTEX_PROJECT_ID=your-project-id \
54+
-v ~/.config/gcloud:/home/claude/.config/gcloud:ro \
55+
-v $(pwd):/workspace \
56+
-w /workspace \
57+
ai-helpers
58+
```
59+
60+
**Environment Variables:**
61+
- `CLAUDE_CODE_USE_VERTEX=1` - Enable Vertex AI integration
62+
- `CLOUD_ML_REGION` - Your GCP region (e.g., `us-east5`)
63+
- `ANTHROPIC_VERTEX_PROJECT_ID` - Your GCP project ID
64+
65+
**Volume Mounts:**
66+
- `-v ~/.config/gcloud:/home/claude/.config/gcloud:ro` - Passes through your gcloud authentication (read-only)
67+
- `-v $(pwd):/workspace` - Mounts your current directory into the container
68+
69+
### Running Commands Non-Interactively
70+
71+
You can execute Claude Code commands directly without entering an interactive session using the `-p` or `--print` flag:
72+
73+
```bash
74+
podman run -it \
75+
-e CLAUDE_CODE_USE_VERTEX=1 \
76+
-e CLOUD_ML_REGION=your-ml-region \
77+
-e ANTHROPIC_VERTEX_PROJECT_ID=your-project-id \
78+
-v ~/.config/gcloud:/home/claude/.config/gcloud:ro \
79+
-v $(pwd):/workspace \
80+
-w /workspace \
81+
ai-helpers \
82+
--print "/hello-world:echo Hello from Claude Code!"
83+
```
84+
85+
This will:
86+
1. Start the container with your gcloud credentials
87+
2. Execute the `/hello-world:echo` command with the provided message
88+
3. Print the response and exit when complete
89+
3590
## Available Plugins
3691

3792
### JIRA Plugin

images/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.21
2+
3+
# Install Node.js and NPM from yum repositories
4+
RUN dnf install -y nodejs npm \
5+
&& dnf clean all
6+
7+
# Install Python 3 and development tools
8+
RUN dnf install -y \
9+
python3 \
10+
python3-pip \
11+
python3-devel \
12+
&& dnf clean all
13+
14+
# Install Claude Code CLI globally
15+
RUN npm install -g @anthropic-ai/claude-code
16+
17+
# Install common Python tools
18+
RUN pip3 install --no-cache-dir \
19+
pytest \
20+
requests \
21+
pyyaml
22+
23+
# Create claude user
24+
RUN useradd -m -u 1000 -s /bin/bash claude
25+
26+
# Copy ai-helpers repository to /opt/ai-helpers
27+
COPY . /opt/ai-helpers
28+
RUN chown -R claude:claude /opt/ai-helpers
29+
30+
# Create Claude configuration directory and copy settings
31+
# Note: We pre-configure known_marketplaces.json because extraKnownMarketplaces doesn't seem to work in non-interactive mode.
32+
RUN mkdir -p /home/claude/.claude/plugins
33+
COPY images/claude-settings.json /home/claude/.claude/settings.json
34+
COPY images/known_marketplaces.json /home/claude/.claude/plugins/known_marketplaces.json
35+
RUN chown -R claude:claude /home/claude/.claude
36+
37+
# Create workspace directory
38+
RUN mkdir -p /workspace && chown -R claude:claude /workspace
39+
WORKDIR /workspace
40+
41+
# Switch to claude user
42+
USER claude
43+
44+
# Set Claude Code as the default command
45+
ENTRYPOINT ["claude"]
46+
47+
# Default to showing help
48+
CMD ["--help"]

images/claude-settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extraKnownMarketplaces": {
3+
"ai-helpers": {
4+
"source": {
5+
"source": "directory",
6+
"path": "/opt/ai-helpers"
7+
}
8+
}
9+
},
10+
"enabledPlugins": {
11+
"hello-world@ai-helpers": true,
12+
"jira@ai-helpers": true,
13+
"ci@ai-helpers": true
14+
}
15+
}

images/known_marketplaces.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"ai-helpers": {
3+
"source": {
4+
"source": "directory",
5+
"path": "/opt/ai-helpers"
6+
},
7+
"installLocation": "/opt/ai-helpers",
8+
"lastUpdated": "2025-10-27T12:00:00.000Z"
9+
}
10+
}

0 commit comments

Comments
 (0)