# Telegram platform images: the home validator (HMAC of Mini App / Login Widget # data, no Bot API, no VPN) and the remote bot (Bot API long-poll + sendMessage, # dialing the gateway over the reverse mTLS bot-link). One build stage compiles both # binaries; the `validator` and `bot` targets each ship one on distroless nonroot. # # The platform imports only the shared scrabble/pkg module, so the build drops the # other workspace modules (backend, gateway, loadtest), the loadtest-only # scrabble/gateway replace and the scrabble-solver replace from a copy of go.work: it # needs neither their sources nor the solver sibling checkout. # Build from the repository ROOT so go.work, pkg/ and platform/telegram/ are all in # the context (see deploy/docker-compose.yml, which sets context: ..). FROM golang:1.26.3-alpine AS build WORKDIR /src COPY go.work go.work.sum ./ COPY pkg ./pkg COPY platform/telegram ./platform/telegram # Reduce the workspace to what the platform needs: only pkg + platform/telegram. RUN go work edit -dropuse=./backend -dropuse=./gateway -dropuse=./loadtest -dropreplace=scrabble/gateway@v0.0.0 -dropreplace=scrabble-solver # VERSION (the deploy passes the git tag) is stamped into both binaries via the linker. ARG VERSION=dev RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-X scrabble/pkg/version.Version=${VERSION}" -o /out/validator ./platform/telegram/cmd/validator RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-X scrabble/pkg/version.Version=${VERSION}" -o /out/bot ./platform/telegram/cmd/bot # The bot's support relay writes its JSON state under /data. Stage an empty directory # owned by the distroless nonroot UID so a fresh named volume mounted there inherits # writable ownership (Docker copies the image dir's mode/owner into an empty volume). RUN mkdir -p /out/data # --- validator (home) -------------------------------------------------------- FROM gcr.io/distroless/static-debian12:nonroot AS validator COPY --from=build /out/validator /usr/local/bin/validator ENTRYPOINT ["/usr/local/bin/validator"] # --- bot (remote) ------------------------------------------------------------ FROM gcr.io/distroless/static-debian12:nonroot AS bot COPY --from=build /out/bot /usr/local/bin/bot COPY --from=build --chown=65532:65532 /out/data /data ENTRYPOINT ["/usr/local/bin/bot"]