-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
35 lines (26 loc) · 1.17 KB
/
Copy pathContainerfile
File metadata and controls
35 lines (26 loc) · 1.17 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
# ---------------------------------------------------------------------------
# Stage 1: Build
# ---------------------------------------------------------------------------
FROM golang:1.26.1-alpine AS builder
WORKDIR /app
# Download dependencies first (layer-cached separately from source)
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
ARG VERSION=dev
ARG COMMIT=unknown
ARG BUILD_TIME=unknown
RUN CGO_ENABLED=0 GOOS=linux go build \
-trimpath \
-ldflags "-s -w \
-X github.com/fgouteroux/haproxy-otel-spoe/internal.Version=${VERSION} \
-X github.com/fgouteroux/haproxy-otel-spoe/internal.Commit=${COMMIT} \
-X github.com/fgouteroux/haproxy-otel-spoe/internal.BuildTime=${BUILD_TIME}" \
-o haproxy-otel-spoe .
# ---------------------------------------------------------------------------
# Stage 2: Runtime — distroless/static includes CA certs, no shell, non-root
# ---------------------------------------------------------------------------
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=builder /app/haproxy-otel-spoe /usr/local/bin/haproxy-otel-spoe
EXPOSE 12345
ENTRYPOINT ["/usr/local/bin/haproxy-otel-spoe"]