Dockerfile.relay-tester raw
1 # Dockerfile for relay-tester
2
3 # Use Debian-based Go image to match runtime stage (avoids musl/glibc linker mismatch)
4 FROM golang:1.25-bookworm AS builder
5
6 # Install build dependencies
7 RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
8
9 # Set working directory
10 WORKDIR /build
11
12 # Copy go mod files
13 COPY go.mod go.sum ./
14 RUN go mod download
15
16 # Copy source code
17 COPY . .
18
19 # Build the relay-tester binary
20 RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o relay-tester ./cmd/relay-tester
21
22 # Runtime stage
23 # Use Debian slim instead of Alpine because Debian's libsecp256k1 includes
24 # Schnorr signatures (secp256k1_schnorrsig_*) and ECDH which Nostr requires.
25 # Alpine's libsecp256k1 is built without these modules.
26 FROM debian:bookworm-slim
27
28 # Install runtime dependencies
29 RUN apt-get update && \
30 apt-get install -y --no-install-recommends ca-certificates libsecp256k1-1 && \
31 rm -rf /var/lib/apt/lists/*
32
33 WORKDIR /app
34
35 # Copy binary (libsecp256k1.so.1 is already installed via apt)
36 COPY --from=builder /build/relay-tester /app/relay-tester
37
38 # Default relay URL (can be overridden)
39 ENV RELAY_URL=ws://orly:3334
40
41 # Run the relay tester
42 ENTRYPOINT ["/app/relay-tester"]
43 CMD ["-url", "${RELAY_URL}"]
44