Files
dchain/Dockerfile
vsecoder 1e7f4d8da4 fix(docker): bump build-stage Go to 1.25 (matches go.mod)
When v2.0.0 added the golang.org/x/image/webp dependency (used by the
media scrubber for WebP decoding), go mod tidy bumped the module's
minimum Go version in go.mod:

  module go-blockchain
  go 1.25.0

The three Dockerfiles in the repo were still pinned to older images:

  /Dockerfile              FROM golang:1.24-alpine
  /deploy/prod/Dockerfile.slim  FROM golang:1.24-alpine
  /docker/media-sidecar/Dockerfile  FROM golang:1.22-alpine

Result: `docker build` on any of them fails at `go mod download` with
  go: go.mod requires go >= 1.25.0 (running go 1.24.13; GOTOOLCHAIN=local)
because Alpine's golang image pins GOTOOLCHAIN=local to keep the
toolchain reproducible.

Fix: bump all three to golang:1.25-alpine. The media-sidecar module
doesn't actually need 1.25 (it's self-contained and only uses stdlib),
but keeping all three in sync avoids surprise the next time somebody
adds a dep.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 22:32:22 +03:00

64 lines
2.5 KiB
Docker

# ---- build stage ----
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Cache module downloads separately from source changes
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build-time version metadata (same convention as deploy/prod/Dockerfile.slim).
ARG VERSION_TAG=dev
ARG VERSION_COMMIT=none
ARG VERSION_DATE=unknown
ARG VERSION_DIRTY=false
RUN LDFLAGS="\
-X go-blockchain/node/version.Tag=${VERSION_TAG} \
-X go-blockchain/node/version.Commit=${VERSION_COMMIT} \
-X go-blockchain/node/version.Date=${VERSION_DATE} \
-X go-blockchain/node/version.Dirty=${VERSION_DIRTY}" && \
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="$LDFLAGS" -o /bin/node ./cmd/node && \
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="$LDFLAGS" -o /bin/client ./cmd/client && \
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="$LDFLAGS" -o /bin/wallet ./cmd/wallet && \
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="$LDFLAGS" -o /bin/peerid ./cmd/peerid
# ---- runtime stage ----
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata netcat-openbsd
COPY --from=builder /bin/node /usr/local/bin/node
COPY --from=builder /bin/client /usr/local/bin/client
COPY --from=builder /bin/wallet /usr/local/bin/wallet
COPY --from=builder /bin/peerid /usr/local/bin/peerid
# Bake testnet keys into image so nodes always load consistent identities
# (avoids Windows volume-mount failures with ./testdata:/keys:ro)
COPY --from=builder /app/testdata/ /keys/
# Bake username_registry contract (messenger username with pricing)
COPY --from=builder /app/contracts/username_registry/username_registry.wasm /keys/username_registry.wasm
COPY --from=builder /app/contracts/username_registry/username_registry_abi.json /keys/username_registry_abi.json
# Bake governance contract (on-chain parameter governance)
COPY --from=builder /app/contracts/governance/governance.wasm /keys/governance.wasm
COPY --from=builder /app/contracts/governance/governance_abi.json /keys/governance_abi.json
# Bake auction contract (English auction with token escrow)
COPY --from=builder /app/contracts/auction/auction.wasm /keys/auction.wasm
COPY --from=builder /app/contracts/auction/auction_abi.json /keys/auction_abi.json
# Bake escrow contract (two-party trustless escrow)
COPY --from=builder /app/contracts/escrow/escrow.wasm /keys/escrow.wasm
COPY --from=builder /app/contracts/escrow/escrow_abi.json /keys/escrow_abi.json
# libp2p P2P port
EXPOSE 4001/tcp
# HTTP stats + explorer + relay API
EXPOSE 8080/tcp
ENTRYPOINT ["/usr/local/bin/node"]