2
0

Dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. FROM --platform=$BUILDPLATFORM docker.io/nixos/nix:2.34.4 AS builder
  2. COPY . /tmp/build
  3. WORKDIR /tmp/build
  4. ARG BUILDOS
  5. ARG BUILDARCH
  6. ARG TARGETOS
  7. ARG TARGETARCH
  8. ARG VERSION
  9. RUN VERSION="$VERSION" nix \
  10. --extra-experimental-features "nix-command flakes" \
  11. --option filter-syscalls false \
  12. build --impure ".#kilo-cross-$TARGETOS-$TARGETARCH"
  13. RUN ln -s ../bin result/bin/"$BUILDOS"_"$BUILDARCH"
  14. FROM alpine:3.23 AS cni
  15. ARG TARGETARCH
  16. ARG CNI_PLUGINS_VERSION=v1.9.0
  17. RUN apk add --no-cache curl && \
  18. curl -Lo cni.tar.gz https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGINS_VERSION/cni-plugins-linux-$TARGETARCH-$CNI_PLUGINS_VERSION.tgz && \
  19. tar -xf cni.tar.gz
  20. FROM alpine:3.23
  21. ARG TARGETOS
  22. ARG TARGETARCH
  23. ARG ALPINE_VERSION=v3.20
  24. LABEL maintainer="squat <lserven@gmail.com>"
  25. RUN echo -e "https://alpine.global.ssl.fastly.net/alpine/$ALPINE_VERSION/main\nhttps://alpine.global.ssl.fastly.net/alpine/$ALPINE_VERSION/community" > /etc/apk/repositories && \
  26. apk add --no-cache ipset iptables ip6tables graphviz font-noto
  27. COPY --from=cni bridge host-local loopback portmap /opt/cni/bin/
  28. ADD https://raw.githubusercontent.com/kubernetes-sigs/iptables-wrappers/e139a115350974aac8a82ec4b815d2845f86997e/iptables-wrapper-installer.sh /
  29. RUN chmod 700 /iptables-wrapper-installer.sh && /iptables-wrapper-installer.sh --no-sanity-check
  30. COPY --from=builder /tmp/build/result/bin/"$TARGETOS"_"$TARGETARCH"/kg /opt/bin/kg
  31. COPY --from=builder /tmp/build/result/bin/"$TARGETOS"_"$TARGETARCH"/kgctl /opt/bin/kgctl
  32. ENTRYPOINT ["/opt/bin/kg"]