github.1git.de/docker/cli@v26.1.3+incompatible/dockerfiles/Dockerfile.vendor (about)

     1  # syntax=docker/dockerfile:1
     2  
     3  ARG GO_VERSION=1.21.10
     4  ARG ALPINE_VERSION=3.18
     5  ARG MODOUTDATED_VERSION=v0.8.0
     6  
     7  FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
     8  ENV GOTOOLCHAIN=local
     9  RUN apk add --no-cache bash git rsync
    10  WORKDIR /src
    11  
    12  FROM base AS vendored
    13  ENV GOPROXY=https://proxy.golang.org|direct
    14  RUN --mount=target=/context \
    15      --mount=target=.,type=tmpfs  \
    16      --mount=target=/go/pkg/mod,type=cache <<EOT
    17  set -e
    18  rsync -a /context/. .
    19  ./scripts/vendor update
    20  mkdir /out
    21  cp -r vendor.mod vendor.sum vendor /out
    22  EOT
    23  
    24  FROM scratch AS update
    25  COPY --from=vendored /out /out
    26  
    27  FROM vendored AS validate
    28  RUN --mount=target=/context \
    29      --mount=target=.,type=tmpfs <<EOT
    30  set -e
    31  rsync -a /context/. .
    32  git add -A
    33  rm -rf vendor
    34  cp -rf /out/* .
    35  ./scripts/vendor validate
    36  EOT
    37  
    38  FROM psampaz/go-mod-outdated:${MODOUTDATED_VERSION} AS go-mod-outdated
    39  FROM base AS outdated
    40  RUN --mount=target=.,rw \
    41      --mount=target=/go/pkg/mod,type=cache \
    42      --mount=from=go-mod-outdated,source=/home/go-mod-outdated,target=/usr/bin/go-mod-outdated \
    43      ./scripts/vendor outdated