# whx relay container: one static binary, no shell needed.
#   docker build -t whx-relay https://webhooks.xyz/static/relay/Dockerfile   # or save this file and build locally
#   docker run -d --name whx-relay --restart unless-stopped \
#     -e WHX_RELAY_TOKEN=whr_… -p 127.0.0.1:9229:9229 whx-relay
# The relay must reach your destination from inside the container network (use --network host, or the
# compose file next to this one). Health: curl -s 127.0.0.1:9229/healthz
FROM alpine:3.20 AS fetch
ARG TARGETOS=linux
ARG TARGETARCH=amd64
RUN apk add --no-cache curl ca-certificates \
 && curl -fsSL -o /whx "https://webhooks.xyz/cli/download/whx-${TARGETOS}-${TARGETARCH}" \
 && chmod 755 /whx

FROM gcr.io/distroless/static:nonroot
COPY --from=fetch /whx /whx
EXPOSE 9229
USER nonroot
ENTRYPOINT ["/whx", "relay", "--health", "0.0.0.0:9229"]
