-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (50 loc) · 2.02 KB
/
Copy pathDockerfile
File metadata and controls
66 lines (50 loc) · 2.02 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
FROM python:3.11-slim AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
git && \
rm -rf /var/lib/apt/lists/*
COPY pyproject.toml README.md ./
COPY src/ src/
RUN pip install --no-cache-dir --prefix=/install \
"agentfield>=0.1.47" \
"pydantic>=2.0" \
"httpx>=0.27" \
"python-dotenv>=1.0" \
"fastapi>=0.100" \
"uvicorn>=0.20" && \
pip install --no-cache-dir --prefix=/install --no-deps .
FROM python:3.11-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
AGENTFIELD_SERVER=http://agentfield:8080 \
HARNESS_PROVIDER=opencode \
HARNESS_MODEL=openrouter/moonshotai/kimi-k2.5 \
AI_MODEL=openrouter/moonshotai/kimi-k2.5 \
PORT=8004 \
HOME=/home/contractaf \
PYTHONPATH=/app/src \
PATH=/home/contractaf/.opencode/bin:${PATH}
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git && \
groupadd --gid 10001 contractaf && \
useradd --uid 10001 --gid contractaf --create-home --home-dir /home/contractaf --shell /bin/sh contractaf && \
su -s /bin/sh contractaf -c "curl -fsSL https://opencode.ai/install | bash" && \
chown -R contractaf:contractaf /app /home/contractaf && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /home/contractaf/.config/opencode && \
echo '{"$schema":"https://opencode.ai/config.json","model":"openrouter/moonshotai/kimi-k2.5","small_model":"openrouter/moonshotai/kimi-k2.5","provider":{"openrouter":{"options":{"apiKey":"{env:OPENROUTER_API_KEY}"},"models":{"moonshotai/kimi-k2.5":{}}}}}' \
> /home/contractaf/.config/opencode/opencode.json && \
chown -R contractaf:contractaf /home/contractaf/.config
COPY --from=builder /install /usr/local
COPY src/ /app/src/
USER contractaf
EXPOSE 8004
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD curl -f http://localhost:8004/health || exit 1
CMD ["python", "-m", "contract_af.app"]