-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (48 loc) · 1.56 KB
/
Dockerfile
File metadata and controls
67 lines (48 loc) · 1.56 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
# Code generated by ADL CLI v0.27.8. DO NOT EDIT.
# This file was automatically generated from an ADL (Agent Definition Language) specification.
# Manual changes to this file may be overwritten during regeneration.
FROM golang:1.26.1-alpine AS builder
# Build arguments for version injection
ARG VERSION="0.2.25"
ARG AGENT_NAME="documentation-agent"
ARG AGENT_DESCRIPTION="A2A agent server that provides Context7-style documentation capabilities for your agents"
WORKDIR /app
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the application with optimized LDD flags and version injection
RUN CGO_ENABLED=0 GOOS=linux go build \
-a \
-installsuffix cgo \
-ldflags="-s -w -extldflags '-static' \
-X 'main.Version=${VERSION}' \
-X 'main.AgentName=${AGENT_NAME}' \
-X 'main.AgentDescription=${AGENT_DESCRIPTION}'" \
-trimpath \
-o main .
# Final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
# Create a2a group and agent user
RUN addgroup -g 1001 a2a && \
adduser -D -u 1001 -G a2a agent
WORKDIR /app
# Copy the binary from builder stage
COPY --from=builder /app/main .
# Copy agent card
COPY --from=builder /app/.well-known ./.well-known
# Change ownership to agent user
RUN chown -R agent:a2a /app
# Switch to non-root user
USER agent
# Expose port
EXPOSE 8080
# Set environment variables
ENV A2A_SERVER_PORT=8080
# Run the application
CMD ["./main"]