Warning, /swf-testbed/Dockerfile is written in an unsupported language. File is not indexed.
0001 # =============================================================================
0002 # Dockerfile for swf-testbed — CLI + workflow agents
0003 # =============================================================================
0004 # Build context: the repository root (parent of swf-testbed, swf-monitor, etc.)
0005 #
0006 # The image installs swf-common-lib, swf-monitor, and swf-testbed so that the
0007 # `testbed run` CLI works out of the box inside a container.
0008 # =============================================================================
0009
0010 # --------------- build stage: install all deps -------------------------------
0011 FROM python:3.11-slim AS builder
0012
0013 RUN apt-get update && apt-get install -y --no-install-recommends \
0014 build-essential libpq-dev libffi-dev git \
0015 && rm -rf /var/lib/apt/lists/*
0016
0017 WORKDIR /build
0018
0019 # Copy the three repos into the build context.
0020 # Build context is the monorepo root so paths are relative to it.
0021 COPY swf-common-lib /build/swf-common-lib
0022 COPY swf-monitor /build/swf-monitor
0023 COPY swf-testbed /build/swf-testbed
0024
0025 # 1. swf-common-lib (shared utilities)
0026 RUN pip install --no-cache-dir /build/swf-common-lib
0027
0028 # 2. swf-monitor dependencies + package
0029 RUN pip install --no-cache-dir -r /build/swf-monitor/requirements.txt \
0030 && pip install --no-cache-dir django-mcp-server django-oauth-toolkit uvicorn \
0031 && pip install --no-cache-dir /build/swf-monitor
0032
0033 # 3. swf-testbed itself (typer CLI, supervisor, psutil, simpy, etc.)
0034 RUN pip install --no-cache-dir /build/swf-testbed
0035
0036 # --------------- runtime stage: slim image -----------------------------------
0037 FROM python:3.11-slim
0038
0039 RUN apt-get update && apt-get install -y --no-install-recommends \
0040 libpq5 wget \
0041 && rm -rf /var/lib/apt/lists/*
0042
0043 # Bring over installed packages from the builder.
0044 COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
0045 COPY --from=builder /usr/local/bin /usr/local/bin
0046
0047 # Copy the testbed source tree (needed at runtime for workflows/, example_agents/, configs).
0048 COPY --from=builder /build/swf-testbed /app
0049 # Keep swf-monitor source available (manage.py for migrations, etc.)
0050 COPY --from=builder /build/swf-monitor /opt/swf-monitor
0051 COPY --from=builder /build/swf-common-lib /opt/swf-common-lib
0052
0053 WORKDIR /app
0054
0055 # Create logs directory that supervisord expects.
0056 RUN mkdir -p /app/logs
0057
0058 # Symlinks so that $SWF_HOME/swf-testbed resolves to /app regardless of
0059 # which path _setup_environment() computes for SWF_HOME.
0060 # agents.supervisord.conf uses: directory=%(ENV_SWF_HOME)s/swf-testbed
0061 RUN ln -s /app /opt/swf-testbed && ln -s /app /usr/local/lib/swf-testbed
0062
0063 # Entrypoint handles environment setup, then runs the requested command.
0064 COPY swf-testbed/docker-entrypoint.sh /docker-entrypoint.sh
0065 RUN chmod +x /docker-entrypoint.sh
0066
0067 ENTRYPOINT ["/docker-entrypoint.sh"]
0068 CMD ["testbed", "run"]