bb0e3e17e5
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 1m22s
Bump DICT_VERSION v1.2.1 -> v1.3.0 across the seed surface: .env.example, the compose build-arg default, both backend Dockerfile stages, the loadtest Dockerfile, the CI dawg-download version, and the deploy/backend docs. v1.3.0 drops the abbreviation class from the Russian word list (scrabble-dictionary #6). This only seeds a FRESH volume; a live contour/prod volume is unaffected (the .seed_version marker wins — seed-drift guard) and moves to v1.3.0 through the admin console (ARCHITECTURE §5). Per-contour deploy still overrides via TEST_/PROD_DICT_VERSION.
56 lines
2.8 KiB
Docker
56 lines
2.8 KiB
Docker
# Multi-stage build for the backend service. Mirrors platform/telegram/Dockerfile:
|
|
# a golang-alpine builder yields a static binary shipped on distroless nonroot.
|
|
#
|
|
# The dictionary DAWGs are baked in from the scrabble-dictionary release artifact
|
|
# — the same set the Go CI downloads — and BACKEND_DICT_DIR points the
|
|
# binary at them. The published solver module is fetched directly from Gitea
|
|
# (GOPRIVATE), so the build stage needs git and network.
|
|
#
|
|
# Build from the repository root so go.work, go.work.sum, pkg/ and backend/ are all
|
|
# in the Docker context:
|
|
# docker build -f backend/Dockerfile -t scrabble-backend .
|
|
|
|
# --- dictionary artifact -----------------------------------------------------
|
|
FROM alpine:3.20 AS dawg
|
|
ARG DICT_VERSION=v1.3.0
|
|
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 backend ./backend
|
|
|
|
# Reduce the workspace to what the backend needs: backend + pkg. loadtest and the
|
|
# gateway replace it requires are not in this context, so drop both.
|
|
RUN go work edit -dropuse=./gateway -dropuse=./platform/telegram -dropuse=./loadtest -dropreplace=scrabble/gateway@v0.0.0
|
|
# VERSION (the deploy passes the git tag) is stamped into the binary via the linker.
|
|
ARG VERSION=dev
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-X scrabble/pkg/version.Version=${VERSION}" -o /out/backend ./backend/cmd/backend
|
|
|
|
# --- runtime -----------------------------------------------------------------
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
# Re-declare the build arg in this stage so it labels the seed dictionary. One
|
|
# DICT_VERSION drives both the artifact the dawg stage downloads and the version
|
|
# label the binary pins, so the resident version equals the release tag.
|
|
ARG DICT_VERSION=v1.3.0
|
|
COPY --from=build /out/backend /usr/local/bin/backend
|
|
# Own the seed dictionary as the nonroot runtime user (UID 65532): a named volume
|
|
# mounted at /opt/dawg inherits this ownership on first use, so the admin console
|
|
# can write new version subdirectories at runtime. The volume preserves uploaded
|
|
# versions across deploys and, once seeded, is not re-seeded — so after bootstrap
|
|
# every dictionary change goes through the console, not a rebuild (ARCHITECTURE.md §5).
|
|
COPY --from=dawg --chown=65532:65532 /dawg /opt/dawg
|
|
ENV BACKEND_DICT_DIR=/opt/dawg
|
|
ENV BACKEND_DICT_VERSION=${DICT_VERSION}
|
|
ENTRYPOINT ["/usr/local/bin/backend"]
|