a5db10c46e
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 14s
CI / ui (pull_request) Successful in 54s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m12s
The dictionary release moved to v1.2.1 while DICT_VERSION stayed pinned at v1.0.0 in CI and the image/compose seed defaults. Two problems: 1. CI validated against a stale dictionary. 2. The contour seed could be bumped on a live volume, which silently relabels the already-seeded bytes — voiding games pinned to the prior label and serving the wrong dictionary for new ones. The flat DAWGs carry no embedded version, so this drift was undetectable. Changes: - Seed-drift guard: OpenWithVersions records the flat dir's version in a .seed_version marker on first boot and refuses to start when a later BACKEND_DICT_VERSION disagrees. DICT_VERSION is now the seed for a *fresh* volume only; a live contour migrates through the admin console (old versions stay resident, in-progress games keep replaying). - Track the current release: CI's DICT_VERSION centralised to one workflow-level env (v1.2.1); image/compose/.env seed defaults bumped to v1.2.1. The deploy job keeps reading the per-contour vars.TEST_DICT_VERSION. - Docs: ARCHITECTURE §5 (decision record), backend/deploy READMEs, PRERELEASE tracker (DV row). Verified locally against the v1.2.1 artifact: gofmt, build, vet, unit and integration (-tags=integration) all green.
44 lines
2.0 KiB
Docker
44 lines
2.0 KiB
Docker
# Multi-stage build for the R2 load harness. Mirrors backend/Dockerfile: a
|
|
# golang-alpine builder yields a static binary on distroless nonroot, with the
|
|
# dictionary DAWGs baked in from the scrabble-dictionary release (the harness runs
|
|
# the same solver as the backend, so it needs the same dictionary). The published
|
|
# scrabble-solver module is fetched from Gitea (GOPRIVATE), so the build stage needs
|
|
# git and network.
|
|
#
|
|
# The harness is not a contour service; build and run it ad hoc, from the repo root
|
|
# so go.work, pkg/, gateway/ and loadtest/ are in the Docker context:
|
|
# docker build -f loadtest/Dockerfile -t scrabble-loadtest .
|
|
# docker run --rm --network scrabble-internal -e POSTGRES_PASSWORD=... scrabble-loadtest run
|
|
|
|
# --- dictionary artifact -----------------------------------------------------
|
|
FROM alpine:3.20 AS dawg
|
|
ARG DICT_VERSION=v1.2.1
|
|
RUN apk add --no-cache curl tar
|
|
RUN mkdir -p /dawg \
|
|
&& curl -fsSL -o /tmp/dawg.tar.gz \
|
|
"https://gitea.iliadenisov.ru/developer/scrabble-dictionary/releases/download/${DICT_VERSION}/scrabble-dawg-${DICT_VERSION}.tar.gz" \
|
|
&& tar xzf /tmp/dawg.tar.gz -C /dawg
|
|
|
|
# --- build -------------------------------------------------------------------
|
|
FROM golang:1.26.3-alpine AS build
|
|
WORKDIR /src
|
|
# git: the published solver module is fetched from Gitea directly (GOPRIVATE).
|
|
RUN apk add --no-cache git
|
|
ENV GOPRIVATE=gitea.iliadenisov.ru/*
|
|
|
|
COPY go.work go.work.sum ./
|
|
COPY pkg ./pkg
|
|
COPY gateway ./gateway
|
|
COPY loadtest ./loadtest
|
|
|
|
# Reduce the workspace to what the harness needs: loadtest + gateway (edge proto) + pkg.
|
|
RUN go work edit -dropuse=./backend -dropuse=./platform/telegram
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/loadtest ./loadtest/cmd/loadtest
|
|
|
|
# --- runtime -----------------------------------------------------------------
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
COPY --from=build /out/loadtest /usr/local/bin/loadtest
|
|
COPY --from=dawg /dawg /opt/dawg
|
|
ENV LOADTEST_DAWG_DIR=/opt/dawg
|
|
ENTRYPOINT ["/usr/local/bin/loadtest"]
|