cache go modules during docker build

Signed-off-by: Frederick F. Kautz IV <fkautz@alumni.cmu.edu>
This commit is contained in:
Frederick F. Kautz IV 2021-03-30 21:13:06 -07:00
parent c5089d5c04
commit 04fd20ed7e

View File

@ -3,6 +3,7 @@
FROM golang:1.16.2-alpine AS build FROM golang:1.16.2-alpine AS build
WORKDIR /src WORKDIR /src
RUN apk add --no-cache file RUN apk add --no-cache file
ENV GOMODCACHE /root/.cache/gocache
RUN --mount=target=. --mount=target=/root/.cache,type=cache \ RUN --mount=target=. --mount=target=/root/.cache,type=cache \
CGO_ENABLED=0 go build -o /out/dagger ./cmd/dagger && file /out/dagger | grep "statically linked" CGO_ENABLED=0 go build -o /out/dagger ./cmd/dagger && file /out/dagger | grep "statically linked"