FROM --platform=$BUILDPLATFORM rust:1.91-trixie AS builder
WORKDIR /app
RUN rustup override set nightly
COPY . .
RUN cargo build --release
FROM --platform=$BUILDPLATFORM debian:trixie-slim
LABEL org.opencontainers.image.authors="yinheli"
LABEL org.opencontainers.image.source="https://github.com/yinheli/kungfu"
RUN apt-get update && \
apt-get install -y iptables && \
apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/apt/lists/*
RUN mkdir /app
WORKDIR /app
COPY --from=builder /app/target/release/kungfu .
COPY --from=builder /app/config config
EXPOSE 53/udp 53/tcp
CMD ["./kungfu"]