fix: Dockerfile — all build and runtime issues
Deploy Research Workbench / deploy (push) Failing after 12m28s

Sequential build failures fixed:
1. uv run playwright install chromium → playwright not in pyproject.toml/venv
   Fix: npm install -g @playwright/cli playwright && playwright install chromium
   Also installs @playwright/cli (the browser CLI used by research agents)

2. uv pip install amplifierd → package not on PyPI
   Fix: uv pip install --system from github.com/microsoft/amplifierd
   Also installs amplifier-foundation (also not on PyPI, git-only dep)
   Uses uv (not plain pip) to respect [tool.uv.sources] resolution

3. COPY frontend/dist/ → dist is gitignored, breaks fresh-clone builds
   Fix: build the frontend inside Docker using the installed Node.js
   (npm ci + npm run build); removes the pre-built dist assumption

Other fixes:
- Add git to apt-get (required for pip/uv git+https installs)
- Fix entrypoint.sh: amplifierd uses 'serve' subcommand and NAME=URI
  bundle format — was: amplifierd --port ... --bundle /path
  now: amplifierd serve --port ... --bundle name=/path --default-bundle name
- Add .dockerignore to exclude node_modules, .venv, dist, .git, etc.
  (keeps build context small and avoids stale artifacts in COPY steps)
This commit is contained in:
Ken
2026-05-26 23:44:20 +00:00
parent c6d8d4dfe6
commit c632a9d147
3 changed files with 54 additions and 17 deletions
+14
View File
@@ -0,0 +1,14 @@
**/__pycache__
**/*.pyc
**/*.egg-info
.venv
backend/.venv
frontend/node_modules
frontend/dist
artifacts
.git
.gitea
.pytest_cache
.ruff_cache
tests
*.swp
+36 -16
View File
@@ -1,12 +1,15 @@
FROM python:3.13-slim FROM python:3.13-slim
# Install system dependencies # ── System dependencies ────────────────────────────────────────────────────────
# Includes Xvfb/VNC stack, git (needed for pip's git+https installs),
# and Chromium runtime libs (for the playwright-managed Chromium binary).
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb \ xvfb \
x11vnc \ x11vnc \
websockify \ websockify \
novnc \ novnc \
curl \ curl \
git \
libnss3 \ libnss3 \
libatk1.0-0 \ libatk1.0-0 \
libatk-bridge2.0-0 \ libatk-bridge2.0-0 \
@@ -25,40 +28,57 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
fonts-liberation \ fonts-liberation \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install Node.js 22.x from nodesource.com # ── Node.js 22.x ──────────────────────────────────────────────────────────────
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \ && apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install uv via pip # ── npm global tools: @playwright/cli + Chromium browser ──────────────────────
RUN pip install uv # @playwright/cli — token-efficient browser CLI used by research agents
# (playwright-cli -s=research open/snapshot/click/type …)
# playwright — provides `playwright install` to download managed Chromium
# Chromium is installed to /root/.cache/ms-playwright/ (default for root user)
RUN npm install -g @playwright/cli playwright \
&& playwright install chromium
# Disable reflinks — overlayfs doesn't support them (EAGAIN inside Docker builds) # ── Python tooling ────────────────────────────────────────────────────────────
RUN pip install uv
# overlayfs inside Docker doesn't support reflinks → use copy mode to avoid EAGAIN
ENV UV_LINK_MODE=copy ENV UV_LINK_MODE=copy
# Copy backend dependency files and install Python dependencies # ── amplifierd: Amplifier session daemon ──────────────────────────────────────
# Not on PyPI — source is github.com/microsoft/amplifierd.
# uv pip --system installs to /usr/local/bin/amplifierd (on PATH by default).
#
# amplifier-foundation is also not on PyPI (it's a pure git package that
# amplifierd depends on), so we install it explicitly in the same step.
# amplifier-core IS on PyPI and will be resolved automatically.
RUN uv pip install --system \
"amplifier-foundation @ git+https://github.com/microsoft/amplifier-foundation@main" \
"amplifierd @ git+https://github.com/microsoft/amplifierd"
# ── Frontend: install deps and build ──────────────────────────────────────────
# Copy package manifests first so npm ci is cached independently of source changes.
COPY frontend/package.json frontend/package-lock.json /app/frontend/
WORKDIR /app/frontend
RUN npm ci
COPY frontend/ /app/frontend/
RUN npm run build
# ── Backend: install Python deps ──────────────────────────────────────────────
COPY backend/pyproject.toml backend/uv.lock /app/backend/ COPY backend/pyproject.toml backend/uv.lock /app/backend/
WORKDIR /app/backend WORKDIR /app/backend
RUN uv sync --frozen RUN uv sync --frozen
# Install Playwright chromium # ── Application files ─────────────────────────────────────────────────────────
RUN uv run playwright install chromium
# Install amplifierd
RUN uv pip install amplifierd
# Copy application files
COPY backend/*.py /app/backend/ COPY backend/*.py /app/backend/
COPY bundle/ /app/bundle/ COPY bundle/ /app/bundle/
COPY frontend/dist/ /app/frontend/dist/
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
# Create artifacts directory
RUN mkdir -p /app/artifacts RUN mkdir -p /app/artifacts
WORKDIR /app WORKDIR /app
EXPOSE 8080 6080 EXPOSE 8080 6080
ENV DISPLAY=:99 ENV DISPLAY=:99
+4 -1
View File
@@ -21,8 +21,11 @@ sleep 1
echo "[OK] noVNC on :6080" echo "[OK] noVNC on :6080"
# (4) Start amplifierd and wait for it to be healthy # (4) Start amplifierd and wait for it to be healthy
# amplifierd uses a 'serve' subcommand; --bundle requires NAME=URI format
cd /app cd /app
amplifierd --port 8410 --bundle /app/bundle/bundle.md & amplifierd serve --port 8410 \
--bundle "research-workbench=/app/bundle/bundle.md" \
--default-bundle research-workbench &
AMPLIFIERD_PID=$! AMPLIFIERD_PID=$!
echo "Waiting for amplifierd..." echo "Waiting for amplifierd..."