forked from a5c-ai/babysitter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (79 loc) · 3.67 KB
/
Dockerfile
File metadata and controls
101 lines (79 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Babysitter Docker Image
# Runs Claude Code with the babysitter plugin pre-installed
#
# Build: docker build -t babysitter .
# Run: docker run -it -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY -e PROMPT="your task" babysitter
FROM node:20-bookworm
LABEL maintainer="a5c.ai"
LABEL description="Claude Code with Babysitter SDK and plugin for orchestrating complex workflows"
# Install system dependencies
RUN apt-get update && apt-get install -y \
jq \
git \
curl \
bash \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user (Claude Code doesn't allow --dangerously-skip-permissions as root)
RUN groupadd -r claude && useradd -r -g claude -m -d /home/claude claude
# Set environment variables
ENV HOME=/home/claude
# Configure npm global prefix for non-root user so hooks can install packages
RUN mkdir -p /home/claude/.local && \
echo "prefix=/home/claude/.local" > /home/claude/.npmrc
# Install Claude Code globally
RUN npm install -g @anthropic-ai/claude-code
# Create workspace and app directories
WORKDIR /app
# Copy package files first for better caching
COPY package.json package-lock.json* ./
COPY packages/sdk/package.json ./packages/sdk/
# Install all dependencies (including dev for build)
RUN npm install --include=dev
# Copy the rest of the application
COPY . .
# Build the SDK
RUN npm run build:sdk
# Clean up dev dependencies after build
ENV NODE_ENV=production
# Install the SDK globally so 'babysitter' CLI is available
RUN npm install -g ./packages/sdk
# Read plugin version from plugin.json (single source of truth)
RUN PLUGIN_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('plugins/babysitter/plugin.json','utf8')).version)") && \
PLUGIN_CACHE="/home/claude/.claude/plugins/cache/a5c-ai/babysitter/${PLUGIN_VERSION}" && \
mkdir -p "${PLUGIN_CACHE}" && \
cp -r plugins/babysitter/* "${PLUGIN_CACHE}/" && \
chmod +x "${PLUGIN_CACHE}/hooks/"*.sh && \
find "${PLUGIN_CACHE}/skills" -name "*.sh" -exec chmod +x {} + 2>/dev/null || true && \
mkdir -p "${PLUGIN_CACHE}/.claude-plugin" && \
echo "{\"name\": \"babysitter\", \"version\": \"${PLUGIN_VERSION}\", \"description\": \"Orchestrate complex workflows with babysitter\", \"author\": {\"name\": \"a5c.ai\", \"email\": \"[email protected]\"}}" > "${PLUGIN_CACHE}/.claude-plugin/plugin.json" && \
mkdir -p /home/claude/.claude/plugins && \
echo "{\"version\": 2, \"plugins\": {\"[email protected]\": [{\"scope\": \"user\", \"installPath\": \"${PLUGIN_CACHE}\", \"version\": \"${PLUGIN_VERSION}\", \"installedAt\": \"2026-02-05T00:00:00.000Z\", \"lastUpdated\": \"2026-02-05T00:00:00.000Z\"}]}}" > /home/claude/.claude/plugins/installed_plugins.json && \
echo '{"enabledPlugins": {"[email protected]": true}}' > /home/claude/.claude/settings.json
# Set ownership of claude home directory
RUN chown -R claude:claude /home/claude
# Copy and setup entrypoint script
COPY docker-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Create workspace directory for mounting projects
RUN mkdir -p /workspace && chown claude:claude /workspace
WORKDIR /workspace
# Ensure user-local npm bin is on PATH (for hooks installing packages at runtime)
ENV PATH="/home/claude/.local/bin:${PATH}"
# Switch to non-root user
USER claude
# Document environment variables
# Standard Anthropic API
ENV ANTHROPIC_API_KEY=""
# Azure Foundry support
ENV CLAUDE_CODE_USE_FOUNDRY=""
ENV ANTHROPIC_FOUNDRY_RESOURCE=""
ENV ANTHROPIC_FOUNDRY_API_KEY=""
ENV ANTHROPIC_DEFAULT_SONNET_MODEL=""
ENV ANTHROPIC_DEFAULT_HAIKU_MODEL=""
ENV ANTHROPIC_DEFAULT_OPUS_MODEL=""
# Azure OpenAI support
ENV AZURE_OPENAI_API_KEY=""
ENV AZURE_OPENAI_PROJECT_NAME=""
# Prompt for babysitter
ENV PROMPT=""
ENTRYPOINT ["/entrypoint.sh"]