A typical go docker pattern is this:
# cache modules
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN make
This will create a (cached) layer for downloaded packages before compiling the actual sources. It would be great to not only download but also compile the packages before adding the application to further speed up repeated builds.
How would one force-compile all downloaded packages irrespective of the parent application?