FROM docker.io/alpine:latest AS builder RUN apk add --no-cache build-base linux-headers COPY mdns-repeater.c /src/ RUN gcc -static -O2 -o /mdns-repeater /src/mdns-repeater.c -lpthread FROM docker.io/alpine:latest AS runtime LABEL org.opencontainers.image.created="%%CREATED%%" LABEL org.opencontainers.image.authors="Ricardo Band " LABEL org.opencontainers.image.url="https://git.xengi.de/xengi/mdns-reflector" LABEL org.opencontainers.image.source="https://git.xengi.de/xengi/mdns-reflector" LABEL org.opencontainers.image.version="latest" LABEL org.opencontainers.image.revision="%%COMMIT%%" LABEL org.opencontainers.image.title="mdns-reflector" LABEL org.opencontainers.image.description="IPv4 + IPv6 mDNS reflector for MikroTik RouterOS" COPY --from=builder /mdns-repeater /usr/local/bin/ COPY --chmod=755 entrypoint.sh / COPY --chmod=755 healthcheck.sh /usr/local/bin/ RUN apk add --no-cache libcap iproute2 su-exec \ && adduser -D -s /sbin/nologin mdns \ && setcap 'cap_net_raw,cap_net_bind_service=+ep' /usr/local/bin/mdns-repeater \ && mkdir -p /tmp \ && chown mdns:mdns /tmp HEALTHCHECK --interval=15s --timeout=5s --start-period=5s --retries=3 \ CMD /usr/local/bin/healthcheck.sh EXPOSE 5353/udp ENTRYPOINT ["/entrypoint.sh"]