ai-code-battle/cmd/acb-evolver/Dockerfile
jedarden 5242d6037c feat(acb-evolver): add weekly automated map evolution ticker
Wire up the acb-map-evolver to run automatically on a weekly schedule
(Sunday 03:00 UTC by default) from the evolver deployment.

The map evolution ticker:
- Waits until the next scheduled time (weekday:hour:minute UTC)
- Runs acb-map-evolver --once to evolve maps for all player counts
- Repeats every 7 days

The schedule can be configured via ACB_MAP_EVOLUTION_SCHEDULE env var
(format: WEEKDAY:HH:MM, e.g., "0:03:00" for Sunday 03:00 UTC).

Enable via ACB_MAP_EVOLUTION_ENABLED=true or --enable-map-evolution flag.

Per plan §14.6: the weekly map evolution loads engagement scores,
runs MAP-Elites evolution, promotes high-scoring variants, and updates
the active map pool in the database.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-08 09:26:38 -04:00

84 lines
2.5 KiB
Docker

# AI Code Battle Evolver Container
# Runs the autonomous evolution pipeline: generates candidate bots via LLM,
# validates them (syntax → schema → sandbox), runs arena tournaments,
# and promotes winners to the live bot fleet.
#
# Needs multiple language runtimes for the 3-stage validation pipeline.
# Build stage
FROM golang:1.25-alpine AS builder
WORKDIR /build
# Install git for module downloads
RUN apk --no-cache add git
# Copy go.mod and go.sum first for caching
COPY go.mod go.sum ./
RUN go mod download
# Copy engine package
COPY engine/ ./engine/
COPY metrics/ ./metrics/
# Copy bots (used as seed programs)
COPY bots/ ./bots/
# Copy evolver source
COPY cmd/acb-evolver/ ./cmd/acb-evolver/
# Copy map evolver source
COPY cmd/acb-map-evolver/ ./cmd/acb-map-evolver/
# Build the evolver binary
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /acb-evolver ./cmd/acb-evolver
# Build the map evolver binary
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /acb-map-evolver ./cmd/acb-map-evolver
# Runtime stage — needs language runtimes for validation sandbox
FROM golang:1.25-alpine
WORKDIR /app
# Install language runtimes for bot validation:
# - go (included in base image)
# - python3, nodejs (typescript), rust (rustup-init), java, php
# - ca-certificates for HTTPS (LLM calls, K8s API)
RUN apk --no-cache add \
ca-certificates \
tzdata \
python3 \
py3-pip \
nodejs \
npm \
curl \
bash
# Install TypeScript compiler globally
RUN npm install -g typescript ts-node
# Copy binaries from builder
COPY --from=builder /acb-evolver /app/acb-evolver
COPY --from=builder /acb-map-evolver /app/acb-map-evolver
# Create non-root user
RUN addgroup -g 1000 acb && adduser -D -u 1000 -G acb acb
USER acb
# Environment variables (set at runtime)
# ACB_DATABASE_URL - PostgreSQL connection string
# ACB_LLM_URL - LLM proxy base URL (e.g., http://zai-proxy:8080)
# ACB_LLM_API_KEY - LLM API key (optional, for ZAI proxy)
# ACB_ENCRYPTION_KEY - AES-256-GCM key for bots table shared secrets
# ACB_KUBECTL_SERVER - kubectl API server URL for bot deployment
# ACB_REGISTRY - Container registry for evolved bot images
# ACB_REPO_DIR - Path to declarative-config repo for K8s manifest writes
# ACB_R2_ENDPOINT - R2 endpoint for live.json upload
# ACB_R2_BUCKET - R2 bucket name
# ACB_R2_ACCESS_KEY - R2 access key
# ACB_R2_SECRET_KEY - R2 secret key
# ACB_EVOLUTION_OUT - Output path for live.json (default: evolution/live.json)
ENTRYPOINT ["/app/acb-evolver"]
CMD ["run"]