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>
36 lines
1.4 KiB
Docker
36 lines
1.4 KiB
Docker
# media-sidecar — FFmpeg-based metadata scrubber for DChain node.
|
|
#
|
|
# Build: docker build -t dchain/media-sidecar -f docker/media-sidecar/Dockerfile .
|
|
# Run: docker run -p 8090:8090 dchain/media-sidecar
|
|
# Compose: see docker-compose.yml; node points DCHAIN_MEDIA_SIDECAR_URL at it.
|
|
#
|
|
# Stage 1 — build a tiny static Go binary.
|
|
FROM golang:1.25-alpine AS build
|
|
WORKDIR /src
|
|
# Copy only what we need (the sidecar main is self-contained, no module
|
|
# deps on the rest of the repo, so this is a cheap, cache-friendly build).
|
|
COPY docker/media-sidecar/main.go ./main.go
|
|
RUN go mod init dchain-media-sidecar 2>/dev/null || true
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/media-sidecar ./main.go
|
|
|
|
# Stage 2 — runtime with ffmpeg. Alpine has a lean ffmpeg build (~90 MB
|
|
# total image, most of it codecs we actually need).
|
|
FROM alpine:3.19
|
|
RUN apk add --no-cache ffmpeg ca-certificates \
|
|
&& addgroup -S dchain && adduser -S -G dchain dchain
|
|
COPY --from=build /out/media-sidecar /usr/local/bin/media-sidecar
|
|
|
|
USER dchain
|
|
EXPOSE 8090
|
|
|
|
# Pin sensible defaults; operator overrides via docker-compose env.
|
|
ENV LISTEN_ADDR=:8090 \
|
|
FFMPEG_BIN=ffmpeg \
|
|
MAX_INPUT_MB=32 \
|
|
JOB_TIMEOUT_SECS=60
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
CMD wget -qO- http://127.0.0.1:8090/healthz || exit 1
|
|
|
|
ENTRYPOINT ["/usr/local/bin/media-sidecar"]
|