Skip to content

Commit

Permalink
feat(docker): download transitive dependencies (runatlantis#3107)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode authored and ijames-gc committed Feb 13, 2024
1 parent e9f52d9 commit 495446d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ ARG ATLANTIS_DATE=unknown
ENV ATLANTIS_DATE=${ATLANTIS_DATE}

WORKDIR /app

# This is needed to download transitive dependencies instead of compiling them
# https://github.com/montanaflynn/golang-docker-cache
# https://github.com/golang/go/issues/27719
COPY go.mod go.sum ./
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get

COPY . /app

RUN --mount=type=cache,target=/go/pkg/mod \
Expand Down

0 comments on commit 495446d

Please sign in to comment.