FROM alpine:3@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48 AS builder
ARG MDNS_REPEATER_VERSION=local
WORKDIR /
COPY mdns-repeater.c mdns-repeater.c
# hadolint ignore=DL3018
RUN set -ex && \
apk add --no-cache build-base && \
gcc -o /bin/mdns-repeater mdns-repeater.c -DMDNS_REPEATER_VERSION=\"${MDNS_REPEATER_VERSION}\"
FROM alpine:3@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48
apk add --no-cache vlan libcap bash
COPY --from=builder /bin/mdns-repeater /bin/mdns-repeater
COPY run.sh /app/
RUN chmod +x /bin/mdns-repeater && setcap cap_net_raw=+ep /bin/mdns-repeater && chmod +x /app/run.sh
# hadolint ignore=DL3025
ENTRYPOINT /bin/bash /app/run.sh "${VLANS}"