Use BuildKit's cache mount.

This commit is contained in:
FireMasterK 2022-02-23 11:33:06 +00:00
parent 422e1a3d1d
commit 2a56a2756d
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
1 changed files with 2 additions and 5 deletions

View File

@ -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