1- # syntax=docker/dockerfile:1.2
2-
1+ # syntax=docker/dockerfile:1
32
43# Copyright 2020 Docker Compose CLI authors
54
1514# See the License for the specific language governing permissions and
1615# limitations under the License.
1716
18- ARG GO_VERSION=1.18 -alpine
19- ARG GOLANGCI_LINT_VERSION=v1.45.2 -alpine
17+ ARG GO_VERSION=1.19 -alpine
18+ ARG GOLANGCI_LINT_VERSION=v1.50.1 -alpine
2019ARG PROTOC_GEN_GO_VERSION=v1.5.2
2120
2221FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base
@@ -43,7 +42,7 @@ FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION} AS lint-base
4342FROM base AS lint
4443ENV GOFLAGS="-buildvcs=false"
4544ENV CGO_ENABLED=0
46- COPY --from=lint-base /usr/bin/golangci-lint /usr/bin/golangci-lint
45+ COPY --from=lint-base --link /usr/bin/golangci-lint /usr/bin/golangci-lint
4746ARG BUILD_TAGS
4847ARG GIT_TAG
4948RUN --mount=target=. \
@@ -89,13 +88,13 @@ RUN --mount=target=. \
8988 make BINARY=/out/docker -f builder.Makefile cross
9089
9190FROM scratch AS protos
92- COPY --from=make-protos /compose-cli/cli/server/protos .
91+ COPY --from=make-protos --link /compose-cli/cli/server/protos .
9392
9493FROM scratch AS cli
95- COPY --from=make-cli /out/* .
94+ COPY --from=make-cli --link /out/* .
9695
9796FROM scratch AS cross
98- COPY --from=make-cross /out/* .
97+ COPY --from=make-cross --link /out/* .
9998
10099FROM base AS test
101100ENV CGO_ENABLED=0
@@ -120,9 +119,11 @@ RUN --mount=type=cache,target=/go/pkg/mod \
120119 go mod tidy
121120
122121FROM scratch AS go-mod-tidy
123- COPY --from=make-go-mod-tidy /compose-cli/go.mod .
124- COPY --from=make-go-mod-tidy /compose-cli/go.sum .
122+ COPY --from=make-go-mod-tidy --link /compose-cli/go.mod .
123+ COPY --from=make-go-mod-tidy --link /compose-cli/go.sum .
125124
126125FROM base AS check-go-mod
127126COPY . .
128- RUN make -f builder.Makefile check-go-mod
127+ RUN --mount=type=cache,target=/go/pkg/mod \
128+ --mount=type=cache,target=/root/.cache/go-build \
129+ make -f builder.Makefile check-go-mod
0 commit comments