forked from anthropics/claude-agent-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
43 lines (33 loc) · 1.43 KB
/
Copy pathDockerfile.test
File metadata and controls
43 lines (33 loc) · 1.43 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
# Dockerfile for running SDK tests in a containerized environment
# This helps catch Docker-specific issues like #406
FROM python:3.12-slim
# Docker's default `RUN` shell is `/bin/sh -c`, which reports only the last
# status of a pipeline: a failed `curl` would be masked by a successful `bash`,
# leaving a green build with no CLI installed. Fail on any element instead.
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install dependencies for Claude CLI and git (needed for some tests)
RUN apt-get update && apt-get install -y \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Claude Code CLI
RUN curl -fsSL https://claude.ai/install.sh | bash
ENV PATH="/root/.local/bin:$PATH"
# Set up working directory
WORKDIR /app
# Copy the SDK source
COPY . .
# Install SDK with dev dependencies
RUN pip install -e ".[dev]"
# Verify CLI installation
RUN claude -v
# Trust the workspace so Claude Code honors this repo's project-scoped
# permission grants and does not emit untrusted-workspace diagnostics on
# stderr. Must come after `claude -v`, which is the last step that writes
# ~/.claude.json. Trust is keyed on the WORKDIR (/app; .dockerignore omits
# .git), so it only applies when the container runs the source baked in here
# from /app -- a bind-mounted checkout at another path is not covered.
# See scripts/trust_workspace.py.
RUN python scripts/trust_workspace.py
# Default: run unit tests
CMD ["python", "-m", "pytest", "tests/", "-v"]