From 08a36d8165ef9f66df48725cabb36429968ebb89 Mon Sep 17 00:00:00 2001 From: royalcat Date: Wed, 19 Jun 2024 18:00:57 +0300 Subject: [PATCH] docker golang build cache --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 00cc99f..89207ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app COPY go.mod ./ COPY go.sum ./ -RUN go mod download +RUN --mount=type=cache,mode=0777,target=/go/pkg/mod go mod download all COPY ./pkg ./pkg COPY ./src ./src @@ -14,7 +14,7 @@ COPY ./templates ./templates COPY embed.go embed.go RUN go generate ./... -RUN CGO_ENABLED=0 go build -tags timetzdata -o /tstor ./cmd/tstor/main.go +RUN --mount=type=cache,mode=0777,target=/go/pkg/mod CGO_ENABLED=0 go build -tags timetzdata -o /tstor ./cmd/tstor/main.go FROM scratch