Merge pull request #221 from fkautz/pr_out_cache_go_modules_during_docker_build

cache go modules during docker build
This commit is contained in:
Andrea Luzzardi 2021-03-31 11:19:02 -07:00 committed by GitHub
commit f3182aa12f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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"