-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.agent
More file actions
33 lines (24 loc) · 915 Bytes
/
Dockerfile.agent
File metadata and controls
33 lines (24 loc) · 915 Bytes
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
# Build stage
FROM golang:1.25.7-alpine3.21 AS builder
ARG VERSION=dev
WORKDIR /app
# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download
# Build with optimizations
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-w -s -X github.com/ignacio/lumo/internal/version.Version=${VERSION}" \
-trimpath \
-o lumo-agent ./cmd/lumo-agent
# Compress binary with UPX (reduces size ~50-70%)
# Note: Using -9 instead of --best --lzma to avoid OOM in constrained environments
RUN apk add --no-cache upx && upx -9 lumo-agent
# Final stage - distroless for security + minimal size
# Using static-debian12 as it includes timezone data and runs as nonroot by default
FROM gcr.io/distroless/static-debian12:nonroot
# Copy CA certificates and timezone data (included in distroless/static)
# Copy binary
COPY --from=builder /app/lumo-agent /lumo-agent
EXPOSE 8080 9090
ENTRYPOINT ["/lumo-agent"]