|
| 1 | +# Build KinD from source with Go 1.25.6 to fix CVE-2025-61726 |
| 2 | +# (KinD v0.31.0 pre-built binaries use Go 1.25.5 which has the vulnerability) |
| 3 | +FROM alpine:3.23 AS kind-builder |
| 4 | +ARG TARGETARCH |
| 5 | +RUN if [ "$TARGETARCH" != "amd64" ] && [ "$TARGETARCH" != "arm64" ]; then \ |
| 6 | + echo "ERROR: Unsupported architecture: $TARGETARCH. KinD is only available for amd64 and arm64."; \ |
| 7 | + exit 1; \ |
| 8 | + fi |
| 9 | +RUN apk add --no-cache go=1.25.6-r0 git |
| 10 | +RUN git clone --depth 1 --branch v0.31.0 https://github.com/kubernetes-sigs/kind.git /kind && \ |
| 11 | + cd /kind && \ |
| 12 | + CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o /kind-binary . |
| 13 | + |
1 | 14 | FROM node:24-alpine3.23 AS base |
2 | 15 |
|
3 | 16 | # Enable pnpm |
@@ -126,20 +139,27 @@ RUN apk --no-cache upgrade && \ |
126 | 139 | rm -rf /tmp/* |
127 | 140 |
|
128 | 141 | # Install KinD (Kubernetes in Docker) and docker-cli for embedded K8s cluster support |
129 | | -RUN apk add --no-cache docker-cli && \ |
130 | | - ARCH=$(uname -m) && \ |
131 | | - if [ "$ARCH" = "x86_64" ]; then \ |
132 | | - KIND_URL="https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-amd64"; \ |
133 | | - KIND_SHA256="eb244cbafcc157dff60cf68693c14c9a75c4e6e6fedaf9cd71c58117cb93e3fa"; \ |
134 | | - elif [ "$ARCH" = "aarch64" ]; then \ |
135 | | - KIND_URL="https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-arm64"; \ |
136 | | - KIND_SHA256="8e1014e87c34901cc422a1445866835d1e666f2a61301c27e722bdeab5a1f7e4"; \ |
137 | | - else \ |
138 | | - echo "ERROR: Unsupported architecture: $ARCH. KinD is only available for x86_64 and aarch64."; \ |
139 | | - exit 1; \ |
140 | | - fi && \ |
141 | | - wget -O /usr/local/bin/kind "${KIND_URL}" && \ |
142 | | - chmod +x /usr/local/bin/kind |
| 142 | +# KinD binary is built from source in kind-builder stage with Go 1.25.6 (CVE-2025-61726 fix) |
| 143 | +RUN apk add --no-cache docker-cli |
| 144 | +COPY --from=kind-builder /kind-binary /usr/local/bin/kind |
| 145 | +RUN chmod +x /usr/local/bin/kind |
| 146 | +# TODO: Once KinD releases a version compiled with Go >= 1.25.6, remove the kind-builder stage |
| 147 | +# at the top of this file and restore the pre-built binary download below for faster builds. |
| 148 | +# Track releases at: https://github.com/kubernetes-sigs/kind/releases |
| 149 | +# RUN ARCH=$(uname -m) && \ |
| 150 | +# if [ "$ARCH" = "x86_64" ]; then \ |
| 151 | +# KIND_URL="https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-amd64"; \ |
| 152 | +# KIND_SHA256="eb244cbafcc157dff60cf68693c14c9a75c4e6e6fedaf9cd71c58117cb93e3fa"; \ |
| 153 | +# elif [ "$ARCH" = "aarch64" ]; then \ |
| 154 | +# KIND_URL="https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-arm64"; \ |
| 155 | +# KIND_SHA256="8e1014e87c34901cc422a1445866835d1e666f2a61301c27e722bdeab5a1f7e4"; \ |
| 156 | +# else \ |
| 157 | +# echo "ERROR: Unsupported architecture: $ARCH. KinD is only available for x86_64 and aarch64."; \ |
| 158 | +# exit 1; \ |
| 159 | +# fi && \ |
| 160 | +# wget -O /usr/local/bin/kind "${KIND_URL}" && \ |
| 161 | +# echo "${KIND_SHA256} /usr/local/bin/kind" | sha256sum -c - && \ |
| 162 | +# chmod +x /usr/local/bin/kind |
143 | 163 |
|
144 | 164 | # Install supervisor from edge repository to address CVE-2023-27482 |
145 | 165 | # https://nvd.nist.gov/vuln/detail/cve-2023-27482 |
|
0 commit comments