|
| 1 | +# Dockerfile for DoubleAgent service |
| 2 | +FROM python:3.12-slim AS builder |
| 3 | + |
| 4 | +WORKDIR /build |
| 5 | + |
| 6 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 7 | + build-essential \ |
| 8 | + git \ |
| 9 | + ca-certificates \ |
| 10 | + && rm -rf /var/lib/apt/lists/* |
| 11 | + |
| 12 | +COPY . . |
| 13 | +RUN python -m pip install --user --no-cache-dir --upgrade pip setuptools wheel |
| 14 | +RUN python -m pip install --user --no-cache-dir .[automation,apdist,mlmodels,tensorflow] |
| 15 | +# Install AFL-automation from fork (add-docker branch) |
| 16 | +# |
| 17 | +# TODO: change this to https://github.com/usnistgov/AFL-automation |
| 18 | +# if this PR gets merged: https://github.com/usnistgov/AFL-automation/pull/120 |
| 19 | +RUN python -m pip install --user --no-cache-dir \ |
| 20 | + "AFL-automation @ git+https://github.com/marshallmcdonnell/AFL-automation@add-docker" |
| 21 | + |
| 22 | +FROM python:3.12-slim |
| 23 | +WORKDIR /app |
| 24 | + |
| 25 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 26 | + ca-certificates \ |
| 27 | + curl \ |
| 28 | + && rm -rf /var/lib/apt/lists/* |
| 29 | + |
| 30 | +# Copy installed packages from builder |
| 31 | +COPY --from=builder /root/.local /root/.local |
| 32 | + |
| 33 | +# Make sure scripts in .local are usable |
| 34 | +ENV PATH=/root/.local/bin:$PATH \ |
| 35 | + PYTHONUNBUFFERED=1 \ |
| 36 | + PYTHONDONTWRITEBYTECODE=1 \ |
| 37 | + PYTHONPATH=/app:$PYTHONPATH \ |
| 38 | + AFL_AGENT_PORT=5003 \ |
| 39 | + TILED_SERVER=http://tiled:8000 \ |
| 40 | + TILED_API_KEY=devkey |
| 41 | + |
| 42 | +# Create configuration directory |
| 43 | +RUN mkdir -p /root/.afl |
| 44 | + |
| 45 | +# Copy agent configuration |
| 46 | +COPY docker/config/agent-config.json /root/.afl/config.json |
| 47 | + |
| 48 | +# Expose the agent port |
| 49 | +EXPOSE 5003 |
| 50 | + |
| 51 | +# Health check against driver_status endpoint |
| 52 | +HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ |
| 53 | + CMD curl -f http://localhost:5003/driver_status || exit 1 |
| 54 | + |
| 55 | +# Default entry point: run the agent driver |
| 56 | +CMD ["python", "-m", "AFL.double_agent.AgentDriver"] |
0 commit comments