Добавить генератор нагрузки, сбор метрик реплик и сценарии экспериментов для отказов, rolling update и трека 1
This commit is contained in:
+25
-4
@@ -1,13 +1,34 @@
|
||||
# Build stage: compile static binaries with the exact toolchain pinned in go.mod.
|
||||
# Modules live in their own layer, rebuilt only when go.mod or go.sum change.
|
||||
# Only the Go sources are copied after it, and the compiler's cache persists
|
||||
# between builds: a change elsewhere in the repository does not trigger a full
|
||||
# recompilation, which matters when a rolling update rebuilds the image.
|
||||
FROM golang:1.27.1-alpine3.23@sha256:d9e2f2f07b10cc922da3e80e035c3058810b328d5aef82d2c63680967c5e2ec9 AS build
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download && go mod verify
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOFLAGS=-mod=readonly go build -trimpath -ldflags="-s -w" -o /out/ ./cmd/server ./cmd/migrate
|
||||
COPY cmd ./cmd
|
||||
COPY internal ./internal
|
||||
COPY migrations ./migrations
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
CGO_ENABLED=0 GOFLAGS=-mod=readonly go build -trimpath -ldflags="-s -w" -o /out/ ./cmd/server ./cmd/migrate
|
||||
|
||||
# Runtime stage: minimal image, unprivileged user, the server is PID 1. The
|
||||
# same image runs the one-shot migrate service with its own entrypoint.
|
||||
# Load generator of the experiments, an image of its own: the API image does
|
||||
# not carry it. Built only for `docker compose --profile bench`.
|
||||
FROM build AS loadgen-build
|
||||
COPY tools ./tools
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
CGO_ENABLED=0 GOFLAGS=-mod=readonly go build -trimpath -ldflags="-s -w" -o /out/loadgen ./tools/loadgen
|
||||
|
||||
FROM alpine:3.23@sha256:fd791d74b68913cbb027c6546007b3f0d3bc45125f797758156952bc2d6daf40 AS loadgen
|
||||
RUN adduser -D -H -u 10001 app
|
||||
COPY --from=loadgen-build /out/loadgen /usr/local/bin/loadgen
|
||||
USER app
|
||||
ENTRYPOINT ["/usr/local/bin/loadgen"]
|
||||
|
||||
# Runtime stage, the last one so that `build: .` builds it: minimal image,
|
||||
# unprivileged user, the server is PID 1. The same image runs the one-shot
|
||||
# migrate service with its own entrypoint.
|
||||
FROM alpine:3.23@sha256:fd791d74b68913cbb027c6546007b3f0d3bc45125f797758156952bc2d6daf40
|
||||
RUN adduser -D -H -u 10001 app
|
||||
COPY --from=build /out/server /out/migrate /usr/local/bin/
|
||||
|
||||
Reference in New Issue
Block a user