diff --git a/tests/eclient/image/Dockerfile b/tests/eclient/image/Dockerfile index b0f34c92c..35c9a51d1 100644 --- a/tests/eclient/image/Dockerfile +++ b/tests/eclient/image/Dockerfile @@ -1,11 +1,44 @@ FROM golang:1.16-alpine AS build +# hadolint ignore=DL3018 +RUN apk add --no-cache \ + musl-dev \ + automake \ + make \ + gcc \ + patch + +COPY patches /patches + WORKDIR /go/src/local_manager COPY pkg . -RUN go build -ldflags "-s -w" -o /out/local_manager main.go +RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o /out/root/local_manager main.go -FROM alpine:3.14.2 +ARG DHCPING_VERSION=1.2 +WORKDIR / +RUN wget -q "https://www.mavetju.org/download/dhcping-${DHCPING_VERSION}.tar.gz" && \ + tar -xvf dhcping-${DHCPING_VERSION}.tar.gz +WORKDIR /dhcping-${DHCPING_VERSION} +RUN set -e && for patch in "/patches/dhcping-${DHCPING_VERSION}"/*.patch; do \ + echo "Applying $patch"; \ + patch -p1 < "$patch"; \ + done +RUN case $(uname -m) in \ + x86_64) \ + ./configure --prefix=/usr; \ + ;; \ + aarch64) \ + ./configure --build=arm64-unknown-linux-gnu --prefix=/usr; \ + ;; \ + esac && \ + make && make DESTDIR=/out install + +COPY files /out/ +COPY cert/id_rsa* /out/root/.ssh/ +COPY cert/id_rsa.pub /out/root/.ssh/authorized_keys + +FROM alpine:3.14.6 # hadolint ignore=DL3018 RUN apk add --no-cache lshw \ @@ -19,14 +52,9 @@ RUN apk add --no-cache lshw \ jq \ setserial \ avahi \ - lsblk \ - dhcping - -COPY cert/id_rsa* /root/.ssh/ -COPY cert/id_rsa.pub /root/.ssh/authorized_keys + lsblk -COPY files / -COPY --from=build /out/local_manager /root/ +COPY --from=build /out / SHELL ["/bin/ash", "-eo", "pipefail", "-c"] RUN mkdir -p /mnt && \ diff --git a/tests/eclient/image/patches/dhcping-1.2/0001-Fix-type-to-not-hit-endless-getopt-loop.patch b/tests/eclient/image/patches/dhcping-1.2/0001-Fix-type-to-not-hit-endless-getopt-loop.patch new file mode 100644 index 000000000..be2c64d16 --- /dev/null +++ b/tests/eclient/image/patches/dhcping-1.2/0001-Fix-type-to-not-hit-endless-getopt-loop.patch @@ -0,0 +1,26 @@ +From 27e74baf97c4669e14b8c690044ab979dc34b2ef Mon Sep 17 00:00:00 2001 +From: Petr Fedchenkov +Date: Tue, 28 Jun 2022 10:54:24 +0300 +Subject: [PATCH] Fix type to not hit endless getopt loop + +Signed-off-by: Petr Fedchenkov +--- + dhcping.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dhcping.c b/dhcping.c +index 7eb5ae6..cdce51c 100644 +--- a/dhcping.c ++++ b/dhcping.c +@@ -70,7 +70,7 @@ unsigned char serveridentifier[4]; + int maxwait=3; + + void doargs(int argc,char **argv) { +- char ch; ++ int ch; + + inform=request=verbose=VERBOSE=quiet=0; + ci=gi=server="0.0.0.0"; +-- +2.34.1 + diff --git a/tests/io_performance/image/Dockerfile b/tests/io_performance/image/Dockerfile index 547872643..2f3baa349 100644 --- a/tests/io_performance/image/Dockerfile +++ b/tests/io_performance/image/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.15 as builder +FROM golang:1.16-alpine as builder WORKDIR /app COPY mkconfig /app/mkconfig