1
- # syntax=docker/dockerfile:1.2
2
-
1
+ # syntax=docker/dockerfile:1
3
2
4
3
# Copyright 2020 Docker Compose CLI authors
5
4
15
14
# See the License for the specific language governing permissions and
16
15
# limitations under the License.
17
16
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
20
19
ARG PROTOC_GEN_GO_VERSION=v1.5.2
21
20
22
21
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base
@@ -43,7 +42,7 @@ FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION} AS lint-base
43
42
FROM base AS lint
44
43
ENV GOFLAGS="-buildvcs=false"
45
44
ENV 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
47
46
ARG BUILD_TAGS
48
47
ARG GIT_TAG
49
48
RUN --mount=target=. \
@@ -89,13 +88,13 @@ RUN --mount=target=. \
89
88
make BINARY=/out/docker -f builder.Makefile cross
90
89
91
90
FROM scratch AS protos
92
- COPY --from=make-protos /compose-cli/cli/server/protos .
91
+ COPY --from=make-protos --link /compose-cli/cli/server/protos .
93
92
94
93
FROM scratch AS cli
95
- COPY --from=make-cli /out/* .
94
+ COPY --from=make-cli --link /out/* .
96
95
97
96
FROM scratch AS cross
98
- COPY --from=make-cross /out/* .
97
+ COPY --from=make-cross --link /out/* .
99
98
100
99
FROM base AS test
101
100
ENV CGO_ENABLED=0
@@ -120,9 +119,11 @@ RUN --mount=type=cache,target=/go/pkg/mod \
120
119
go mod tidy
121
120
122
121
FROM 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 .
125
124
126
125
FROM base AS check-go-mod
127
126
COPY . .
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