Ports main.py's _combat_session_delta / _combat_merge_into_lifetime (incl. the documented "offense/defense use latest, additively" quirk) and the combat_stats handler (session delta -> DB-backed lifetime merge -> delete-then-insert of combat_stats + combat_stats_sessions). Read handlers gain the live combat overlay (union live + DB), like Python. Validation: - combat.go `combat-merge` CLI folds snapshots through the accumulator; diffed against the Python functions on identical input -> byte-IDENTICAL. - combat_test.go golden test runs in the build (go test now part of the tracker Dockerfile). - Live: 40 combat lifetime rows + 40 session snapshots + rare_events flowing in dereth_go via the shadow consumer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
769 B
Docker
21 lines
769 B
Docker
# Multi-stage build: compile a static Go binary, ship it on distroless.
|
|
# No host Go toolchain required — everything happens inside the build stage.
|
|
FROM golang:1.25-bookworm AS build
|
|
WORKDIR /src
|
|
|
|
# No local Go toolchain is available to maintain go.sum, so resolve and lock
|
|
# dependencies inside the build (network is available here). `go mod tidy`
|
|
# reads the imports from the source and writes go.mod/go.sum, then we build.
|
|
COPY . .
|
|
RUN go mod tidy
|
|
RUN go test ./...
|
|
ARG BUILD_VERSION=dev
|
|
RUN CGO_ENABLED=0 GOOS=linux go build \
|
|
-trimpath \
|
|
-ldflags "-s -w -X main.buildVersion=${BUILD_VERSION}" \
|
|
-o /out/tracker-go .
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
COPY --from=build /out/tracker-go /tracker-go
|
|
EXPOSE 8770
|
|
ENTRYPOINT ["/tracker-go"]
|