Files
seaweedfs/test/kafka/kafka-client-loadtest/Dockerfile.loadtest
Chris LuandGitHub f720f559cb ci(kafka-loadtest): switch off Ubuntu/Debian base images to avoid apt mirror flakes (#9119)
* ci(kafka-loadtest): retry apt-get to survive Ubuntu mirror flakes

The Kafka Quick Test workflow's Docker build of Dockerfile.loadtest
keeps hitting "Connection failed [IP: ...]" on archive.ubuntu.com /
security.ubuntu.com mid-build, e.g.:

    failed to solve: process "/bin/sh -c apt-get update && \
      apt-get install -y ca-certificates curl jq bash netcat ..."
      did not complete successfully: exit code: 100

Same class of failure PR #9106 fixed for pjdfstest. Apply the same
two retry knobs to Dockerfile.loadtest and Dockerfile.seektest so a
transient mirror flake retries five times with a 30s timeout instead
of failing the whole workflow.

(The fuller pjdfstest fix also restructured the build to use
docker/build-push-action with type=gha cache. Doing that for
kafka-client-loadtest would mean rewriting the make/docker-compose
build path; defer until the apt-retry alone proves insufficient.)

* ci(kafka-loadtest): also drop recommends/suggests + apt-get clean

Address PR review (gemini-code-assist): fully align with PR #9106's
pattern by adding --no-install-recommends / --no-install-suggests so
the runtime images stay small and don't pull in extra packages, plus
apt-get clean before rm -rf /var/lib/apt/lists/* in Dockerfile.seektest.

* ci(kafka-loadtest): use alpine / maven base images instead of apt

The previous rounds of apt-retry / apt-clean knobs aren't enough:
the Ubuntu mirror is persistently unreachable from the GitHub runner
for minutes at a time, which blows past the 5-retry / 30-second
Acquire configuration and still kills the build (see run 24551809614).

Switch both runtime images so no apt fetch is needed at all:

- Dockerfile.loadtest now runs on alpine:3.20. All runtime deps
  (ca-certificates, curl, jq, bash, netcat-openbsd) are in the
  Alpine main repo, fetched from Alpine's CDN rather than the
  Ubuntu archive that keeps going dark.
- Dockerfile.seektest now uses maven:3.9-eclipse-temurin-11, which
  ships JDK 11 and Maven preinstalled — no apt-get maven step.

This also means the runtime images no longer care about
Acquire::Retries / DEBIAN_FRONTEND / apt-get clean, so those lines
are removed with the apt call they were configuring.
2026-04-17 07:43:19 -07:00

52 lines
1.4 KiB
Docker

# Kafka Client Load Test Runner Dockerfile
# Multi-stage build for cross-platform support
# Stage 1: Builder
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Copy go module files
COPY test/kafka/kafka-client-loadtest/go.mod test/kafka/kafka-client-loadtest/go.sum ./
RUN go mod download
# Copy source code
COPY test/kafka/kafka-client-loadtest/ ./
# Build the loadtest binary
RUN CGO_ENABLED=0 GOOS=linux go build -o /kafka-loadtest ./cmd/loadtest
# Stage 2: Runtime
# Use alpine so we don't depend on Ubuntu apt mirrors, which intermittently
# refuse connections from GitHub Actions runners and fail the CI build.
# All runtime dependencies we need (ca-certificates, curl, jq, bash, nc)
# are in the Alpine main repo.
FROM alpine:3.20
RUN apk add --no-cache \
ca-certificates \
curl \
jq \
bash \
netcat-openbsd
# Copy built binary from builder stage
COPY --from=builder /kafka-loadtest /usr/local/bin/kafka-loadtest
RUN chmod +x /usr/local/bin/kafka-loadtest
# Copy scripts and configuration
COPY test/kafka/kafka-client-loadtest/scripts/ /scripts/
COPY test/kafka/kafka-client-loadtest/config/ /config/
# Create results directory
RUN mkdir -p /test-results
# Make scripts executable
RUN chmod +x /scripts/*.sh
WORKDIR /app
# Default command runs the comprehensive load test
CMD ["/usr/local/bin/kafka-loadtest", "-config", "/config/loadtest.yaml"]