File size: 3,329 Bytes
af1bee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330591c
af1bee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Patchwise: one application image (web app + API + workflow worker + test executor + practice pod).
# Build from the project root:  docker build -t patch-coworker:1.0.0 .
# Run with deploy/docker-compose.yml (adds Temporal and an HTTPS proxy). All customer data lives in the /data volume.

# ---- 1. build the web app
FROM node:22-bookworm-slim AS web
WORKDIR /src/web
COPY web/package.json web/package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY web/ ./
RUN npm run build

# ---- 2. runtime: Python backend + Node (Playwright executor, PDF, practice pod) + Chromium
FROM python:3.13-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 \
    FPT_HOME=/data FPT_LIBRARY_GIT=/data/library.git PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
    FPT_API_HOST=0.0.0.0 FPT_API_PORT=8800
# Hugging Face Spaces: its own storage bucket, so it never overwrites the Patchwise Space or the Render demo. Behind a proxy, so:
# new accounts start as viewers (an admin grants consultant or QA rights in Settings > Users), sign-in limits count
# per visitor behind the proxy, e-mail links use the fixed address, and no cross-origin callers are allowed.
ENV FPT_ORCHESTRATOR=langgraph FPT_COOKIE_SECURE=always FPT_CASE_WRITEBACK=0 PATCH_WATCH_ENABLED=0 \
    FPT_REGISTER_ROLE=viewer SUPABASE_BUCKET=patchwise-agent-studio FPT_ORG_NAME=Demo \
    FPT_EMBED_ORIGIN=https://huggingface.co FPT_TRUST_PROXY=1 FPT_CORS_ORIGINS="[]" FPT_API_DOCS=0 \
    FPT_PUBLIC_URL=https://energyvenom-patchwise-agent-studio.hf.space
RUN apt-get update \
 && apt-get install -y --no-install-recommends ca-certificates curl git gnupg tini \
 && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
 && apt-get install -y --no-install-recommends nodejs \
 && rm -rf /var/lib/apt/lists/*
WORKDIR /app

# Python dependencies first (cached unless the pins change)
COPY architecture/requirements.txt architecture/requirements.txt
COPY coworker/requirements.txt coworker/requirements.txt
RUN pip install -r coworker/requirements.txt

# Node dependencies + the Chromium the executor drives (with its OS libraries)
COPY automation/package.json automation/package-lock.json automation/
RUN cd automation && npm ci --no-audit --no-fund && npx playwright install --with-deps chromium \
 && rm -rf /var/lib/apt/lists/*
COPY mock-app/package.json mock-app/package-lock.json mock-app/
RUN cd mock-app && npm ci --omit=dev --no-audit --no-fund

# Application code and the test library (scenarios, recipes, coverage maps, the QA rule)
COPY coworker/ coworker/
COPY automation/ automation/
COPY mock-app/ mock-app/
COPY architecture/p2p_graph.py architecture/p2p_graph.py
COPY reports/generate_report.py reports/generate_report.py
COPY triage/ triage/
COPY qa/ qa/
COPY tests/ tests/
COPY analysis/ analysis/
COPY config/ config/
COPY deploy/entrypoint.sh deploy/entrypoint.sh
COPY --from=web /src/web/dist web/dist

# Run as an unprivileged user; /data is the only place that keeps state
RUN useradd --create-home --uid 1000 fpt \
 && mkdir -p /data \
 && chmod +x deploy/entrypoint.sh \
 && chown -R fpt:fpt /app /data
USER fpt
VOLUME ["/data"]
EXPOSE 8800
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=5 \
  CMD curl -fsS http://127.0.0.1:8800/api/ready || exit 1
ENTRYPOINT ["tini", "--", "/app/deploy/entrypoint.sh"]