Skip to content

Instantly share code, notes, and snippets.

@sgarcez
Created September 29, 2025 13:32
Show Gist options
  • Select an option

  • Save sgarcez/4632770a4e33c94e2ac1810b0ed59758 to your computer and use it in GitHub Desktop.

Select an option

Save sgarcez/4632770a4e33c94e2ac1810b0ed59758 to your computer and use it in GitHub Desktop.
FROM node:18-slim AS base
RUN apt-get update && apt-get install -y \
curl \
git \
openssh-client \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g @anthropic-ai/claude-code
WORKDIR /workspace
FROM base AS claude-runner
ARG CLAUDE_PROMPT
COPY --from=remotesource . .
RUN --mount=type=secret,id=anthropic_key \
export ANTHROPIC_API_KEY="$(cat /run/secrets/anthropic_key)" && \
echo "Executing Claude with prompt: $CLAUDE_PROMPT" && \
claude -p "$CLAUDE_PROMPT" 2>&1 | tee output.txt || echo "Claude execution failed"
FROM scratch AS output
COPY --from=claude-runner /workspace/output.txt /output.txt
#!/bin/sh
docker build \
--builder cloud-docker-default \
--secret id=anthropic_key,src=/var/anthropic/api_key \
--build-arg CLAUDE_PROMPT="summarize the readme file" \
-f Dockerfile.claude-code \
--progress plain \
--target output \
--output . \
--build-context [email protected]:docker/compose.git \
--ssh default=$SSH_AUTH_SOCK \
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment