File size: 2,094 Bytes
dabd9d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use the matching Playwright Python image for browsergym-core 0.14.3.
FROM mcr.microsoft.com/playwright/python:v1.44.0-jammy

# Set working directory
WORKDIR /app/env

# Install only the extra packages this env still needs on top of the Playwright image.
RUN apt-get update && apt-get install -y --no-install-recommends \
    fonts-unifont \
    fonts-noto-color-emoji \
    git \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy environment files first (for better caching)
# Build context should be envs/browsergym_env/ (not server/ or repo root)
COPY . .

# Make start script executable
RUN chmod +x /app/env/server/start.sh

# Install Python dependencies using pip install -e . (from pyproject.toml)
RUN pip install --no-cache-dir -e .

# Ensure the installed Playwright package has a matching Chromium runtime.
RUN python -m playwright install chromium

# Install MiniWoB++ from a pinned snapshot to avoid flaky Hub-time git clones.
ARG MINIWOB_COMMIT=7fd85d71a4b60325c6585396ec4f48377d049838
RUN mkdir -p /app/miniwob-plusplus && \
    curl -L "https://github.com/Farama-Foundation/miniwob-plusplus/archive/${MINIWOB_COMMIT}.tar.gz" \
    | tar -xz --strip-components=1 -C /app/miniwob-plusplus

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV BROWSERGYM_BENCHMARK=miniwob
ENV BROWSERGYM_TASK_NAME="click-test"
ENV BROWSERGYM_HEADLESS=true
ENV BROWSERGYM_VIEWPORT_WIDTH=1280
ENV BROWSERGYM_VIEWPORT_HEIGHT=720
ENV BROWSERGYM_TIMEOUT=10000
ENV BROWSERGYM_PORT=8000
ENV MINIWOB_HTML_DIR=/app/miniwob-plusplus/miniwob/html
ENV MINIWOB_HTTP_PORT=8888
ENV MINIWOB_URL=http://127.0.0.1:8888/miniwob/
ENV ENABLE_WEB_INTERFACE=true

# For WebArena tasks, these should be set by the user when running the container:
# ENV SHOPPING=
# ENV SHOPPING_ADMIN=
# ENV REDDIT=
# ENV GITLAB=
# ENV MAP=
# ENV WIKIPEDIA=
# ENV HOMEPAGE=

# Expose ports
EXPOSE 8000
EXPOSE 8888

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:8000/health || exit 1

# Run the server using the start script
CMD ["/app/env/server/start.sh"]