From 6eeacae1fb064bf6cd3ec26c662b339e52805cd3 Mon Sep 17 00:00:00 2001 From: Maciej Kisielewski Date: Wed, 16 Oct 2024 15:02:04 +0200 Subject: [PATCH 1/2] modify dockerfile builder image so it can run tests Add missing files that prevented the `go test` from passing. This enables local testing, including testing that uses internet and runs a production-like scenarios. The tests can be run with: ``` docker run --cap-add=SYS_ADMIN -it builder-image go test -v ./... \ -tags="privileged containerized" ``` --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ae057a4..007a243 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,8 @@ COPY ./testutil/ testutil/ COPY ./manifest/ manifest/ COPY ./dnfconfig/ dnfconfig/ COPY ./srcconfig/ srcconfig/ +COPY ./configfiles/ configfiles/ +COPY ./pki /pki RUN go mod download && go build -o /usr/bin/eext FROM base as deploy From cdc5b227b5ae1aa14d9e4cd9be9b3d4bb92ac2a1 Mon Sep 17 00:00:00 2001 From: Maciej Kisielewski Date: Fri, 18 Oct 2024 14:52:32 +0200 Subject: [PATCH 2/2] sort the copying in the dockerfile --- Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 007a243..a42ed15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,18 +15,18 @@ USER root RUN dnf install -y golang-1.21.* && dnf clean all RUN mkdir -p /src/code.arista.io/eos/tools/eext && mkdir -p /usr/bin WORKDIR /src/code.arista.io/eos/tools/eext -COPY ./go.mod ./ -COPY ./go.sum ./ COPY ./*.go ./ COPY ./cmd/ cmd/ +COPY ./configfiles/ configfiles/ +COPY ./dnfconfig/ dnfconfig/ +COPY ./go.mod ./ +COPY ./go.sum ./ COPY ./impl/ impl/ -COPY ./util/ util/ -COPY ./testutil/ testutil/ COPY ./manifest/ manifest/ -COPY ./dnfconfig/ dnfconfig/ +COPY ./pki/ pki/ COPY ./srcconfig/ srcconfig/ -COPY ./configfiles/ configfiles/ -COPY ./pki /pki +COPY ./testutil/ testutil/ +COPY ./util/ util/ RUN go mod download && go build -o /usr/bin/eext FROM base as deploy