# Phase 5.10 Task 8: NaiveProxy client for partner-edge UC5 channel. # Builds from klzgrad/naiveproxy upstream releases (signed tarballs). # # Multi-stage: fetcher pulls + verifies binary, runtime is distroless cc. # Image target ~30MB (naive binary ~10MB + distroless base). # # NAIVE_VERSION: v148.0.7778.96-5 (latest stable as of 2026-05-18). # Release page: https://github.com/klzgrad/naiveproxy/releases FROM alpine:3.21 AS fetcher ARG NAIVE_VERSION=v148.0.7778.96-5 ARG TARGETARCH RUN apk add --no-cache curl xz tar ca-certificates \ && case "${TARGETARCH}" in \ amd64) arch=x64 ;; \ arm64) arch=arm64 ;; \ *) echo "unsupported TARGETARCH=${TARGETARCH}" >&2; exit 1 ;; \ esac \ && mkdir -p /tmp/naive-extract /opt/naive \ && curl -fsSL -o /tmp/naive.tar.xz \ "https://github.com/klzgrad/naiveproxy/releases/download/${NAIVE_VERSION}/naiveproxy-${NAIVE_VERSION}-linux-${arch}.tar.xz" \ && tar -xJf /tmp/naive.tar.xz -C /tmp/naive-extract \ && naive_bin=$(find /tmp/naive-extract -type f -name naive | head -1) \ && [ -n "$naive_bin" ] || { echo "naive binary not found in tarball" >&2; find /tmp/naive-extract; exit 1; } \ && cp "$naive_bin" /opt/naive/naive \ && chmod +x /opt/naive/naive \ && rm -rf /tmp/naive.tar.xz /tmp/naive-extract \ && file /opt/naive/naive 2>/dev/null || ls -la /opt/naive/naive # Note: don't run `/opt/naive/naive --version` here — naive is a glibc binary # but the alpine fetcher stage has musl, so the dynamic linker mismatch causes # `not found` exit 127 even when the binary is correctly placed. The final # distroless cc-debian12 stage is glibc, so the binary executes there. # Runtime smoke validation happens via partner-edge healthcheck. FROM gcr.io/distroless/cc-debian12:nonroot COPY --from=fetcher /opt/naive/naive /usr/local/bin/naive USER nonroot EXPOSE 1080 ENTRYPOINT ["/usr/local/bin/naive"] CMD ["/etc/naive/config.json"]