mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 12:41:09 +02:00
Replace 21 separate NestJS Matrix bot processes (~2.1 GB RAM, ~4.2 GB Docker images) with a single Go binary using plugin architecture (8.6 MB binary, ~30 MB RAM). New services: - services/mana-matrix-bot/ — Go Matrix bot with 21 plugins (mautrix-go, Redis sessions) - services/mana-api-gateway-go/ — Go API gateway (rate limiting, API keys, credit billing) Deleted: - 21 services/matrix-*-bot/ directories - packages/bot-services/ and packages/matrix-bot-common/ - Legacy deploy scripts and CI build jobs Updated: - docker-compose.macmini.yml: new Go services, legacy bots removed - CI/CD: change detection + build jobs for Go services - Root package.json: new dev:matrix, build:matrix, test:matrix scripts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
688 B
Docker
28 lines
688 B
Docker
# Build stage
|
|
FROM golang:1.25-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy Go module files first for better caching
|
|
COPY services/mana-matrix-bot/go.mod services/mana-matrix-bot/go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source
|
|
COPY services/mana-matrix-bot/ .
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /mana-matrix-bot ./cmd/server
|
|
|
|
# Runtime stage
|
|
FROM alpine:3.21
|
|
|
|
RUN apk --no-cache add ca-certificates tzdata
|
|
|
|
COPY --from=builder /mana-matrix-bot /usr/local/bin/mana-matrix-bot
|
|
|
|
VOLUME /app/data
|
|
|
|
EXPOSE 4000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD wget -q --spider http://localhost:4000/health || exit 1
|
|
|
|
ENTRYPOINT ["mana-matrix-bot"]
|