-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (57 loc) · 2.01 KB
/
Dockerfile
File metadata and controls
76 lines (57 loc) · 2.01 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
# Multi-stage Dockerfile for pytest-agents
# Stage 1: Build TypeScript agents
FROM node:20-alpine AS ts-builder
WORKDIR /build
# Copy package files for all agents
COPY pm/package*.json ./pm/
COPY research/package*.json ./research/
COPY index/package*.json ./index/
# Install dependencies for each agent
RUN cd pm && npm ci && cd ../research && npm ci && cd ../index && npm ci
# Copy source files and build
COPY pm/ ./pm/
COPY research/ ./research/
COPY index/ ./index/
RUN cd pm && npm run build && \
cd ../research && npm run build && \
cd ../index && npm run build
# Stage 2: Python runtime with Node.js
# Using Alpine for smaller attack surface and fewer Debian-specific vulnerabilities
FROM python:3.11-alpine
# Install Node.js and build dependencies
# Alpine uses musl libc instead of glibc, avoiding Debian-specific CVEs
RUN apk add --no-cache \
nodejs \
npm \
git \
&& npm install -g npm@latest
WORKDIR /app
# Install uv for Python package management
RUN pip install --no-cache-dir uv
# Copy Python package files
COPY pyproject.toml uv.lock README.md ./
COPY src/ ./src/
# Install Python dependencies
RUN uv pip install --system -e ".[dev]"
# Copy built TypeScript agents from builder
COPY --from=ts-builder /build/pm/dist ./pm/dist
COPY --from=ts-builder /build/research/dist ./research/dist
COPY --from=ts-builder /build/index/dist ./index/dist
# Copy node_modules for runtime
COPY --from=ts-builder /build/pm/node_modules ./pm/node_modules
COPY --from=ts-builder /build/research/node_modules ./research/node_modules
COPY --from=ts-builder /build/index/node_modules ./index/node_modules
# Copy test suite
COPY tests/ ./tests/
# Copy configuration files
COPY Makefile README.md ./
# Create non-root user for security (Alpine uses adduser)
RUN adduser -D -u 1000 appuser && \
chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTEST_AGENTS_PROJECT_ROOT=/app
# Default command runs verification
CMD ["pytest-agents", "verify"]