Skip to content

Commit

Permalink
improve docker caching
Browse files Browse the repository at this point in the history
  • Loading branch information
inductor committed Feb 19, 2023
1 parent 70fe324 commit e6ab105
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docker-images/mod-downloader/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
FROM golang:1.20-bullseye as builder
WORKDIR /go/src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o /mod-downloader
COPY --link go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
COPY --link . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o /mod-downloader

FROM gcr.io/distroless/static:nonroot

Expand Down

0 comments on commit e6ab105

Please sign in to comment.