Skip to content

Instantly share code, notes, and snippets.

@developer-guy
Created March 31, 2022 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save developer-guy/34d6d7aae831965b3365ea801b2291b0 to your computer and use it in GitHub Desktop.
Save developer-guy/34d6d7aae831965b3365ea801b2291b0 to your computer and use it in GitHub Desktop.
mount cache types
..
# will cache go packages while downloading packages
RUN --mount=type=cache,target=/go/pkg/mod go mod download
# will cache build ouputs and go packages while building the binary
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build -o /out/example .
..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment