From 2a56a2756dda29fe6fad8c92a8d6cfec134e399a Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 23 Feb 2022 11:33:06 +0000 Subject: [PATCH] Use BuildKit's cache mount. --- Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 13bbeb3..0bfce89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,10 @@ FROM golang:latest AS build WORKDIR /app/ -COPY go.mod go.sum ./ - -RUN go mod download - COPY . . -RUN go build -ldflags "-s -w" main.go +RUN --mount=type=cache,target=/root/.cache/go-build \ + go build -ldflags "-s -w" main.go FROM debian:unstable-slim