-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (49 loc) · 1.85 KB
/
Dockerfile
File metadata and controls
61 lines (49 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
# ============================================================
# Aethelred Validator Node — Production Dockerfile
# ============================================================
# Multi-stage build for a minimal, secure production image.
#
# Usage:
# docker build -t aethelredd:latest .
# docker run --rm aethelredd:latest version
# ============================================================
# ------------------------------------
# Stage 1: Build the Go binary
# ------------------------------------
FROM --platform=$BUILDPLATFORM golang:1.25.8-bookworm AS builder
WORKDIR /build
# Cache dependency downloads
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
# Build with optimizations and version info
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ARG VERSION=dev
ARG COMMIT=unknown
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build \
-tags production \
-ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT}" \
-trimpath \
-o /build/bin/aethelredd \
./cmd/aethelredd/
# ------------------------------------
# Stage 2: Minimal production image
# ------------------------------------
FROM gcr.io/distroless/static-debian12:nonroot
LABEL org.opencontainers.image.source="https://github.com/aethelred/aethelred"
LABEL org.opencontainers.image.description="Aethelred Validator Node"
LABEL org.opencontainers.image.licenses="Apache-2.0"
# Copy binary
COPY --from=builder /build/bin/aethelredd /usr/bin/aethelredd
# Use non-root user (distroless default)
USER nonroot:nonroot
# Default ports: P2P (26656), RPC (26657), gRPC (9090), REST (1317), Prometheus (26660)
EXPOSE 26656 26657 9090 1317 26660
# Health check via RPC status endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
CMD ["/usr/bin/aethelredd", "status"]
ENTRYPOINT ["/usr/bin/aethelredd"]
CMD ["start"]