Skip to content

Commit 7c3b020

Browse files
authored
Merge pull request #111 from hbelmiro/cache-images
UPSTREAM: <carry>: Added cached layer for Go dependencies to Dockerfiles
2 parents e27b687 + 142df82 commit 7c3b020

7 files changed

+26
-2
lines changed

backend/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ RUN dnf install -y cmake clang openssl
3030
COPY ${SOURCE_CODE}/go.mod ./
3131
COPY ${SOURCE_CODE}/go.sum ./
3232

33+
RUN GO111MODULE=on go mod download
34+
3335
# Copy the source
3436
COPY ${SOURCE_CODE}/ ./
3537

backend/Dockerfile.cacheserver

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@ RUN apk update && apk upgrade && \
1919
apk add --no-cache bash git openssh gcc musl-dev
2020

2121
WORKDIR /go/src/github.com/kubeflow/pipelines
22+
23+
COPY ./go.mod ./
24+
COPY ./go.sum ./
25+
COPY ./hack/install-go-licenses.sh ./hack/
26+
27+
RUN GO111MODULE=on go mod download
28+
RUN ./hack/install-go-licenses.sh
29+
2230
COPY . .
2331

2432
RUN GO111MODULE=on go build -o /bin/cache_server backend/src/cache/*.go
2533

2634
# Check licenses and comply with license terms.
27-
RUN ./hack/install-go-licenses.sh
2835
# First, make sure there's no forbidden license.
2936
RUN go-licenses check ./backend/src/cache
3037
RUN go-licenses csv ./backend/src/cache > /tmp/licenses.csv && \

backend/Dockerfile.driver

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ USER root
2828
COPY ${SOURCE_CODE}/go.mod ./
2929
COPY ${SOURCE_CODE}/go.sum ./
3030

31+
RUN GO111MODULE=on go mod download
32+
3133
# Copy the source
3234
COPY ${SOURCE_CODE}/ ./
3335

backend/Dockerfile.launcher

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ USER root
3030
COPY ${SOURCE_CODE}/go.mod ./
3131
COPY ${SOURCE_CODE}/go.sum ./
3232

33+
RUN GO111MODULE=on go mod download
34+
3335
# Copy the source
3436
COPY ${SOURCE_CODE}/ ./
3537

backend/Dockerfile.persistenceagent

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ RUN dnf install -y bash git openssh gcc
3030
COPY ${SOURCE_CODE}/go.mod ./
3131
COPY ${SOURCE_CODE}/go.sum ./
3232

33+
RUN GO111MODULE=on go mod download
34+
3335
# Copy the source
3436
COPY ${SOURCE_CODE}/ ./
3537

backend/Dockerfile.scheduledworkflow

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ RUN dnf upgrade -y && \
3535
COPY ${SOURCE_CODE}/go.mod ./
3636
COPY ${SOURCE_CODE}/go.sum ./
3737

38+
RUN GO111MODULE=on go mod download
39+
3840
# Copy the source
3941
COPY ${SOURCE_CODE}/ ./
4042

backend/Dockerfile.viewercontroller

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ RUN apk update && apk upgrade
1818
RUN apk add --no-cache git gcc musl-dev
1919

2020
WORKDIR /src/github.com/kubeflow/pipelines
21+
22+
COPY ./go.mod ./
23+
COPY ./go.sum ./
24+
COPY ./hack/install-go-licenses.sh ./hack/
25+
26+
RUN GO111MODULE=on go mod download
27+
RUN ./hack/install-go-licenses.sh
28+
2129
COPY . .
2230

2331
RUN GO111MODULE=on go build -o /bin/controller backend/src/crd/controller/viewer/*.go
2432
# Check licenses and comply with license terms.
25-
RUN ./hack/install-go-licenses.sh
2633
# First, make sure there's no forbidden license.
2734
RUN go-licenses check ./backend/src/crd/controller/viewer
2835
RUN go-licenses csv ./backend/src/crd/controller/viewer > /tmp/licenses.csv && \

0 commit comments

Comments
 (0)