실험·앱 계층 설계서 3.1의 demo-app api(컨테이너 계층). /healthz, /readyz(DB ping +
legacy /healthz), /api/orders GET/POST(app.orders), /api/price/{item}(legacy-api via ILB,
LEGACY_TIMEOUT 기본 2s), /metrics(demo_http_*). OTLP 트레이스는 OTEL_EXPORTER_OTLP_ENDPOINT
설정 시 전송(otelhttp). 이미지는 공개 Artifact Registry selfheal-public(노드 익명 pull).
16 lines
517 B
Docker
16 lines
517 B
Docker
# demo-app api (Kubernetes layer of the self-healing lab). Built with Cloud Build into the public Artifact Registry repo.
|
|
FROM golang:1.27.1-alpine AS build
|
|
WORKDIR /src
|
|
ENV CGO_ENABLED=0 GOFLAGS=-mod=mod
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN go build -trimpath -ldflags="-s -w" -o /out/demo-api .
|
|
|
|
FROM alpine:3.22
|
|
RUN apk add --no-cache ca-certificates && adduser -D -u 10001 app
|
|
USER 10001
|
|
COPY --from=build /out/demo-api /usr/local/bin/demo-api
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/demo-api"]
|