atproto relay in zig zlay.waow.tech
relay zig atproto
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647# Multi-stage build for Linux amd64 and arm64. The build runs natively for the# selected Docker platform; production selects linux/amd64 explicitly.FROM debian:bookworm-slim AS builderARG ZIG_VERSION=0.17.0RUN apt-get update && apt-get install -y --no-install-recommends curl xz-utils ca-certificates && rm -rf /var/lib/apt/lists/*RUN set -eux; \ case "$(dpkg --print-architecture)" in \ amd64) zig_arch=x86_64; zig_sha256=1cbe9df9f27e6b78d14ccbca43b6703a404ef79ef1c463de901d7f088d4e2026 ;; \ arm64) zig_arch=aarch64; zig_sha256=9e8d11661d4ae3bd57702a3832781e23ad151dde5798e16a5ccd503f65234ff8 ;; \ *) echo "unsupported architecture: $(dpkg --print-architecture)" >&2; exit 1 ;; \ esac; \ curl -fSL "https://ziglang.org/download/${ZIG_VERSION}/zig-${zig_arch}-linux-${ZIG_VERSION}.tar.xz" -o /tmp/zig.tar.xz; \ echo "${zig_sha256} /tmp/zig.tar.xz" | sha256sum --check -; \ tar xJf /tmp/zig.tar.xz -C /opt; \ rm /tmp/zig.tar.xz; \ mv "/opt/zig-${zig_arch}-linux-${ZIG_VERSION}" /opt/zigENV PATH=/opt/zig:$PATHWORKDIR /build
# fetch dependencies first (cacheable — only changes when build.zig.zon changes)COPY build.zig build.zig.zon ./RUN for delay in 0 2 5; do \ sleep "$delay"; \ zig build --fetch=all && exit 0; \ done; \ exit 1
# then copy source and buildCOPY src/ src/# Io.Threaded is the production backend; the old Io.Uring stdlib patch is not# needed. Keep glibc for its allocator behavior under the thread-per-PDS model.RUN set -eux; \ case "$(dpkg --print-architecture)" in \ amd64) target=x86_64-linux-gnu ;; \ arm64) target=aarch64-linux-gnu ;; \ *) echo "unsupported architecture: $(dpkg --print-architecture)" >&2; exit 1 ;; \ esac; \ zig build -Doptimize=ReleaseSafe -Dcpu=baseline "-Dtarget=${target}"
FROM debian:bookworm-slimRUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*COPY --from=builder /build/zig-out/bin/zlay /usr/local/bin/zlayRUN mkdir -p /data/events /data/collection-indexENV RELAY_DATA_DIR=/data/eventsEXPOSE 3000 3001ENTRYPOINT ["/usr/local/bin/zlay"]