From a942bad8b3fed02defcf0f42fb45577e6f293a09 Mon Sep 17 00:00:00 2001 From: Sivanantham Chinnaiyan Date: Fri, 16 Feb 2024 17:07:05 +0530 Subject: [PATCH] Reorder Go docker files for better layer caching Signed-off-by: Sivanantham Chinnaiyan --- Dockerfile | 2 +- agent.Dockerfile | 3 ++- router.Dockerfile | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9abd1b0098a..6425e3e3253 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ WORKDIR /go/src/github.com/kserve/kserve COPY go.mod go.mod COPY go.sum go.sum -RUN go mod download +RUN go mod download COPY cmd/ cmd/ COPY pkg/ pkg/ diff --git a/agent.Dockerfile b/agent.Dockerfile index 07d0260eec6..70a529bd5a2 100644 --- a/agent.Dockerfile +++ b/agent.Dockerfile @@ -5,10 +5,11 @@ FROM golang:1.21 as builder WORKDIR /go/src/github.com/kserve/kserve COPY go.mod go.mod COPY go.sum go.sum + RUN go mod download -COPY pkg/ pkg/ COPY cmd/ cmd/ +COPY pkg/ pkg/ # Build RUN CGO_ENABLED=0 GOOS=linux go build -a -o agent ./cmd/agent diff --git a/router.Dockerfile b/router.Dockerfile index 1b3e2413840..c9a416d5124 100644 --- a/router.Dockerfile +++ b/router.Dockerfile @@ -8,8 +8,8 @@ COPY go.sum go.sum RUN go mod download -COPY pkg/ pkg/ COPY cmd/ cmd/ +COPY pkg/ pkg/ # Build RUN CGO_ENABLED=0 go build -a -o router ./cmd/router