cluster

Infrastructure files for Nordgedanken and Midnightthoughts.
git clone git://archive.git.mtrnord.blog/MTRNord/cluster.git
Log | Files | Refs | README

Dockerfile (1114B)


      1 # Multi-stage build — produces a fully static binary (no CGO, no libolm).
      2 # The goolm build tag enables mautrix-go's pure-Go Olm/Megolm implementation.
      3 
      4 # Build stage runs on the native host arch; cross-compiles via GOARCH.
      5 # {"$imagepolicy": "flux-system:docker-golang-1-25-bookworm"}
      6 FROM --platform=$BUILDPLATFORM golang:1.25-bookworm@sha256:29e59af995c51a5bf63d072eca973b918e0e7af4db0e4667aa73f1b8da1a6d8c AS builder
      7 ARG TARGETARCH
      8 
      9 WORKDIR /app
     10 
     11 # Copy module files first for layer caching. go.sum is generated by go mod tidy
     12 # at build time since we cannot run it locally in the gitops pipeline.
     13 COPY go.mod ./
     14 COPY . .
     15 
     16 RUN go mod tidy
     17 RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} \
     18     go build \
     19     -tags goolm \
     20     -ldflags="-s -w" \
     21     -o /matrix-backup \
     22     .
     23 
     24 # Runtime stage — distroless/static has no shell, no libc, minimal attack surface.
     25 # {"$imagepolicy": "flux-system:gcr-distroless-static-nonroot"}
     26 FROM gcr.io/distroless/static:nonroot@sha256:e3f945647ffb95b5839c07038d64f9811adf17308b9121d8a2b87b6a22a80a39
     27 
     28 COPY --from=builder /matrix-backup /matrix-backup
     29 
     30 ENTRYPOINT ["/matrix-backup"]