8700fbfae1
- backend + gateway multi-stage distroless Dockerfiles; the gateway embeds and
serves the SPA at / and /telegram/ via go:embed (committed dist placeholder,
real build baked in by the image's node stage)
- deploy/docker-compose.yml: backend + gateway + Postgres + Telegram connector
(VPN sidecar) + OTel Collector + Prometheus (15d) + Tempo (72h) + Grafana,
fronted by a caddy owning a single /_gm Basic-Auth (admin console + Grafana
subpath); inter-service on a private network, only caddy on the edge network
- new metrics: backend accounts_created_total{kind} (robots excluded) and an
in-memory gateway active_users{window=24h,7d} gauge
- CI: single .gitea/workflows/ci.yaml (unit/integration/ui + a gated test-contour
deploy) on the new feature/* -> development -> master branch model; the old
go-unit/integration/ui-test workflows are folded in; the connector-scoped
compose is retired (superseded by deploy/)
- docs: ARCHITECTURE §11/§12/§13, root + gateway READMEs, CLAUDE.md branching,
PLAN.md (stage 16 done + refinements + Stage 17 forward-notes)
43 lines
1.8 KiB
Docker
43 lines
1.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
|
|
# (Stage 14) — 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.0.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.
|
|
RUN go work edit -dropuse=./gateway -dropuse=./platform/telegram
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/backend ./backend/cmd/backend
|
|
|
|
# --- runtime -----------------------------------------------------------------
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
COPY --from=build /out/backend /usr/local/bin/backend
|
|
COPY --from=dawg /dawg /opt/dawg
|
|
ENV BACKEND_DICT_DIR=/opt/dawg
|
|
ENTRYPOINT ["/usr/local/bin/backend"]
|