-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.agent
More file actions
73 lines (53 loc) · 1.85 KB
/
Dockerfile.agent
File metadata and controls
73 lines (53 loc) · 1.85 KB
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
68
69
70
71
72
73
# Parameterized Dockerfile for building individual Stats Agent components
# Usage: docker build --build-arg AGENT=research -t stats-agent-research .
#
# Supported AGENT values:
# - research
# - synthesis
# - verification
# - orchestration
# - orchestration-eino
# - direct
#
# CONFIG_FILE: Which config to use (default: config.json, use config.aws.json for AWS)
ARG AGENT=research
ARG CONFIG_FILE=config.json
# Stage 1: Build the specified agent
FROM golang:1.25-alpine AS builder
ARG AGENT
# Install build dependencies
RUN apk add --no-cache git make
WORKDIR /build
# Copy go mod files first for layer caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the specified agent (use directory to include all .go files)
RUN go build -ldflags="-s -w" -o /build/bin/agent ./agents/${AGENT}/
# Stage 2: Create minimal runtime image
FROM alpine:3.19
ARG AGENT
ARG CONFIG_FILE
ENV AGENT_NAME=${AGENT}
# Install runtime dependencies
RUN apk add --no-cache ca-certificates wget
# Create non-root user for security
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/bin/agent /app/agent
# Copy config file (for config.json-based configuration)
COPY ${CONFIG_FILE} /app/config.json
# Set ownership
RUN chown -R appuser:appgroup /app
USER appuser
# Labels for container metadata
LABEL org.opencontainers.image.title="Stats Agent - ${AGENT}" \
org.opencontainers.image.description="Statistics Agent Team - ${AGENT} component" \
org.opencontainers.image.source="https://github.com/agentplexus/stats-agent-team"
# Health check (port configured via env)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT:-8080}/health || exit 1
# Run the agent
ENTRYPOINT ["/app/agent"]