web-agent / Dockerfile
umesh linga
Install pinned Playwright dependency explicitly
a5ce5a9 verified
Raw History Blame Contribute Delete
1.69 kB
# web-agent — Hugging Face Spaces (Docker SDK) image.
#
# Base image route: the official Playwright Python image, pinned to
# v1.64.1-jammy — the exact Playwright version in the system's own
# venv (verified: lab venv has playwright 1.64.1, and this tag exists
# on mcr.microsoft.com). The image ships the Playwright Python package,
# its matching Chromium build, and every system library Chromium
# needs, all preinstalled. That makes the Spaces build a pure file
# copy: no apt step and no ~150 MB browser download at build time,
# which is the slow, failure-prone part of the alternative route
# (python:3.12-slim + `playwright install --with-deps chromium`).
#
# The application itself is a pure standard-library Python server
# (see README "How live runs execute"). The agent system it runs is
# vendored byte-identical under system/ (the container cannot reach
# the ~/workspace/browser-agent-lab checkout).
#
# Hugging Face Spaces: the app must bind the port declared as
# app_port in the README metadata (7860). The server reads PORT
# (app.py), defaulting to 8000 for local runs.
FROM mcr.microsoft.com/playwright/python:v1.64.1-jammy
ENV PORT=7860 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
COPY . ./
# The base image ships the Playwright package, but the Spaces runtime's
# interpreter could not import it (ModuleNotFoundError at first deploy,
# 2026-10-25). Install the pinned dependency explicitly for the same
# python3 that runs app.py; the matching Chromium build is already in
# the base image (PLAYWRIGHT_BROWSERS_PATH=/ms-playwright).
RUN python3 -m pip install --no-cache-dir -r requirements.txt
EXPOSE 7860
CMD ["python3", "app.py"]