From 142df824abecffeb613bf14a17d6e4dc5548bcab Mon Sep 17 00:00:00 2001 From: Helber Belmiro Date: Mon, 11 Nov 2024 17:38:02 -0300 Subject: [PATCH] UPSTREAM: : Added cached layer for Go dependencies to Dockerfiles Signed-off-by: Helber Belmiro --- backend/Dockerfile | 2 ++ backend/Dockerfile.cacheserver | 9 ++++++++- backend/Dockerfile.driver | 2 ++ backend/Dockerfile.launcher | 2 ++ backend/Dockerfile.persistenceagent | 2 ++ backend/Dockerfile.scheduledworkflow | 2 ++ backend/Dockerfile.viewercontroller | 9 ++++++++- 7 files changed, 26 insertions(+), 2 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index e769f7cd4fe..05fab08013b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -30,6 +30,8 @@ RUN dnf install -y cmake clang openssl COPY ${SOURCE_CODE}/go.mod ./ COPY ${SOURCE_CODE}/go.sum ./ +RUN GO111MODULE=on go mod download + # Copy the source COPY ${SOURCE_CODE}/ ./ diff --git a/backend/Dockerfile.cacheserver b/backend/Dockerfile.cacheserver index 1def8f51363..4e7d3508bd3 100644 --- a/backend/Dockerfile.cacheserver +++ b/backend/Dockerfile.cacheserver @@ -19,12 +19,19 @@ RUN apk update && apk upgrade && \ apk add --no-cache bash git openssh gcc musl-dev WORKDIR /go/src/github.com/kubeflow/pipelines + +COPY ./go.mod ./ +COPY ./go.sum ./ +COPY ./hack/install-go-licenses.sh ./hack/ + +RUN GO111MODULE=on go mod download +RUN ./hack/install-go-licenses.sh + COPY . . RUN GO111MODULE=on go build -o /bin/cache_server backend/src/cache/*.go # Check licenses and comply with license terms. -RUN ./hack/install-go-licenses.sh # First, make sure there's no forbidden license. RUN go-licenses check ./backend/src/cache RUN go-licenses csv ./backend/src/cache > /tmp/licenses.csv && \ diff --git a/backend/Dockerfile.driver b/backend/Dockerfile.driver index b78f28c7d9c..b2f21f30a89 100644 --- a/backend/Dockerfile.driver +++ b/backend/Dockerfile.driver @@ -28,6 +28,8 @@ USER root COPY ${SOURCE_CODE}/go.mod ./ COPY ${SOURCE_CODE}/go.sum ./ +RUN GO111MODULE=on go mod download + # Copy the source COPY ${SOURCE_CODE}/ ./ diff --git a/backend/Dockerfile.launcher b/backend/Dockerfile.launcher index 6572bf5b26f..e91228c485c 100644 --- a/backend/Dockerfile.launcher +++ b/backend/Dockerfile.launcher @@ -30,6 +30,8 @@ USER root COPY ${SOURCE_CODE}/go.mod ./ COPY ${SOURCE_CODE}/go.sum ./ +RUN GO111MODULE=on go mod download + # Copy the source COPY ${SOURCE_CODE}/ ./ diff --git a/backend/Dockerfile.persistenceagent b/backend/Dockerfile.persistenceagent index 4e5faa82ec7..5fc5231f804 100644 --- a/backend/Dockerfile.persistenceagent +++ b/backend/Dockerfile.persistenceagent @@ -30,6 +30,8 @@ RUN dnf install -y bash git openssh gcc COPY ${SOURCE_CODE}/go.mod ./ COPY ${SOURCE_CODE}/go.sum ./ +RUN GO111MODULE=on go mod download + # Copy the source COPY ${SOURCE_CODE}/ ./ diff --git a/backend/Dockerfile.scheduledworkflow b/backend/Dockerfile.scheduledworkflow index 65d0132d058..a71b5d877e7 100644 --- a/backend/Dockerfile.scheduledworkflow +++ b/backend/Dockerfile.scheduledworkflow @@ -35,6 +35,8 @@ RUN dnf upgrade -y && \ COPY ${SOURCE_CODE}/go.mod ./ COPY ${SOURCE_CODE}/go.sum ./ +RUN GO111MODULE=on go mod download + # Copy the source COPY ${SOURCE_CODE}/ ./ diff --git a/backend/Dockerfile.viewercontroller b/backend/Dockerfile.viewercontroller index 32278729f13..73f4fbdb1db 100644 --- a/backend/Dockerfile.viewercontroller +++ b/backend/Dockerfile.viewercontroller @@ -18,11 +18,18 @@ RUN apk update && apk upgrade RUN apk add --no-cache git gcc musl-dev WORKDIR /src/github.com/kubeflow/pipelines + +COPY ./go.mod ./ +COPY ./go.sum ./ +COPY ./hack/install-go-licenses.sh ./hack/ + +RUN GO111MODULE=on go mod download +RUN ./hack/install-go-licenses.sh + COPY . . RUN GO111MODULE=on go build -o /bin/controller backend/src/crd/controller/viewer/*.go # Check licenses and comply with license terms. -RUN ./hack/install-go-licenses.sh # First, make sure there's no forbidden license. RUN go-licenses check ./backend/src/crd/controller/viewer RUN go-licenses csv ./backend/src/crd/controller/viewer > /tmp/licenses.csv && \