Ctrl K
ComunidadGuías…

Dockerfile.e2eprobe

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# syntax=docker/dockerfile:experimental
# Build stage
# Pin the builder to the runner's native arch ($BUILDPLATFORM) and
# cross-compile to the requested $TARGETARCH. Avoids QEMU emulation of
# the Go toolchain, which is 10-20x slower on multi-arch builds.
#
# Pinned to an exact patch: the image sets GOTOOLCHAIN=local, so the builder
# Go version must be >= the `go` directive in go.mod or `go mod download`
# hard-fails. Bump this whenever that directive moves.
FROM --platform=$BUILDPLATFORM golang:1.27.3-alpine AS builder
WORKDIR /app

RUN apk add --no-cache git

COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
    go mod download

COPY . .

# TARGETARCH is provided automatically by buildx (e.g. amd64, arm64)
ARG TARGETARCH
ENV CGO_ENABLED=0 \
    GOOS=linux
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    GOARCH=$TARGETARCH go build -ldflags="-w -s" -trimpath -o e2eprobe cmd/e2eprobe/main.go

# Final stage
FROM alpine:3.24
RUN apk --no-cache add ca-certificates tzdata && \
    addgroup -S app && adduser -S -G app app

WORKDIR /app
COPY --from=builder /app/e2eprobe .
RUN chown -R app:app /app

# All e2eprobe defaults now live in internal/ee/e2eprobe/config.go and match
# cmd/e2eprobe/.env.example, so nothing needs baking here. Override any knob
# at runtime with -e VAR=val.
ENV TZ=UTC
USER app

# Required at runtime (not baked — keeps secrets out of image layers):
#   E2EPROBE_API_HOST, E2EPROBE_API_KEY
# Optional at runtime (used for trace/alert attributes if set):
#   E2EPROBE_TENANT_ID, E2EPROBE_ENVIRONMENT_ID

EXPOSE 8765
CMD ["./e2eprobe"]