atproto relay implementation in zig zlay.waow.tech
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 33 lines 1.7 kB view raw
1# multi-stage build: compile natively inside x86_64 linux container 2# uses Debian (glibc) because zig's C++ codegen for musl 3# produces illegal instructions in RocksDB's LRU cache 4FROM --platform=linux/amd64 debian:bookworm-slim AS builder 5RUN apt-get update && apt-get install -y --no-install-recommends curl xz-utils ca-certificates && rm -rf /var/lib/apt/lists/* 6RUN curl -fSL https://ziglang.org/builds/zig-x86_64-linux-0.16.0-dev.3059+42e33db9d.tar.xz \ 7 | tar xJ -C /opt 8ENV PATH=/opt/zig-x86_64-linux-0.16.0-dev.3059+42e33db9d:$PATH 9WORKDIR /build 10 11# patch Io.Uring networking (stubbed as Unavailable upstream, zig#31723) 12COPY patches/ patches/ 13RUN patch /opt/zig-x86_64-linux-0.16.0-dev.3059+42e33db9d/lib/std/Io/Uring.zig < patches/uring-networking.patch 14 15# fetch dependencies first (cacheable — only changes when build.zig.zon changes) 16COPY build.zig build.zig.zon ./ 17RUN zig build --fetch-only 2>/dev/null || true 18 19# then copy source and build 20COPY src/ src/ 21# ReleaseFast: Evented + ReleaseSafe GPFs immediately on startup (fiber.zig 22# contextSwitch, confirmed 2026-04-05). This is a zig codegen bug, not our code. 23# ReleaseFast avoids the bad optimization path. The previous production SIGSEGV 24# under ReleaseFast was a websocket handshake bug, now fixed (9ac64da). 25RUN zig build -Doptimize=ReleaseSafe -Dcpu=baseline -Dtarget=x86_64-linux-gnu 26 27FROM --platform=linux/amd64 debian:bookworm-slim 28RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/* 29COPY --from=builder /build/zig-out/bin/zlay /usr/local/bin/zlay 30RUN mkdir -p /data/events /data/collection-index 31ENV RELAY_DATA_DIR=/data/events 32EXPOSE 3000 3001 33ENTRYPOINT ["/usr/local/bin/zlay"]