33 lines
1.1 KiB
Docker
33 lines
1.1 KiB
Docker
# Agent Factory — Docker deployment template
|
|
# Runs a Claude Code agent system in an isolated container.
|
|
# Replace {{PROJECT_NAME}} and {{ANTHROPIC_API_KEY}} with real values
|
|
# (or pass them at runtime via .env / docker compose env_file).
|
|
|
|
FROM node:22-slim
|
|
|
|
# Install Claude Code globally
|
|
RUN npm install -g @anthropic-ai/claude-code
|
|
|
|
# Create a non-root agent user for security
|
|
RUN useradd -m -s /bin/bash agent
|
|
|
|
WORKDIR /home/agent/project
|
|
|
|
# Copy project files (adjust to your project structure)
|
|
COPY --chown=agent:agent . .
|
|
|
|
# Set up entrypoint script
|
|
COPY --chown=agent:agent docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
USER agent
|
|
|
|
# API key injected at runtime — never bake into image
|
|
ENV ANTHROPIC_API_KEY={{ANTHROPIC_API_KEY}}
|
|
|
|
# Health check — entrypoint writes /tmp/agent-health on each beat
|
|
HEALTHCHECK --interval=60s --timeout=10s --start-period=30s --retries=3 \
|
|
CMD test -f /tmp/agent-health && \
|
|
test $(( $(date +%s) - $(date +%s -r /tmp/agent-health 2>/dev/null || echo 0) )) -lt 300
|
|
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|