Files
iperf3-monitor/exporter/Dockerfile
google-labs-jules[bot] e1164a597e feat: Add support for arm64 architecture
This commit introduces support for the arm64 architecture by:

1.  **Updating the Dockerfile:**
    *   The `exporter/Dockerfile` now uses the `TARGETARCH` build argument to dynamically determine the correct path for `libiperf.so.0`. This allows the same Dockerfile to be used for building both `amd64` and `arm64` images.

2.  **Modifying GitHub Workflows:**
    *   The CI workflow (`.github/workflows/ci.yaml`) and the Release workflow (`.github/workflows/release.yml`) have been updated to build and push multi-architecture Docker images (`linux/amd64` and `linux/arm64`).
    *   This involves adding the `docker/setup-qemu-action` for cross-compilation and specifying the target platforms in the `docker/build-push-action`.

3.  **Helm Chart:**
    *   No changes were required for the Helm chart as the image tag will now point to a multi-arch manifest, and the default iperf3 server image (`networkstatic/iperf3:latest`) is assumed to be multi-arch. Node selectors in the chart are not architecture-specific.

These changes enable the deployment of the iperf3-monitor on Kubernetes clusters with arm64 nodes.
2025-06-20 13:00:09 +00:00

37 lines
1.0 KiB
Docker

# Stage 1: Build stage with dependencies
FROM python:3.9-slim as builder
WORKDIR /app
# Install iperf3 and build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc iperf3 libiperf-dev && \
rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Stage 2: Final runtime stage
FROM python:3.9-slim
WORKDIR /app
# Declare TARGETARCH arg to be used in COPY instruction
ARG TARGETARCH
# Copy iperf3 binary and library from the builder stage
COPY --from=builder /usr/bin/iperf3 /usr/bin/iperf3
COPY --from=builder /usr/lib/${TARGETARCH}-linux-gnu/libiperf.so.0 /usr/lib/${TARGETARCH}-linux-gnu/libiperf.so.0
# Copy installed Python packages from the builder stage
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
# Copy the exporter application code
COPY exporter.py .
# Expose the metrics port
EXPOSE 9876
# Set the entrypoint
CMD ["python", "exporter.py"]