mirror of https://github.com/docker/compose.git
Merge pull request #1014 from chris-crone/containerize-go-mod-tidy
Containerize go mod tidy
This commit is contained in:
commit
3190456101
15
Dockerfile
15
Dockerfile
|
@ -95,7 +95,7 @@ COPY --from=make-cli /out/* .
|
|||
FROM scratch AS cross
|
||||
COPY --from=make-cross /out/* .
|
||||
|
||||
FROM base as test
|
||||
FROM base AS test
|
||||
ENV CGO_ENABLED=0
|
||||
ARG BUILD_TAGS
|
||||
ARG GIT_TAG
|
||||
|
@ -106,11 +106,20 @@ RUN --mount=target=. \
|
|||
GIT_TAG=${GIT_TAG} \
|
||||
make -f builder.Makefile test
|
||||
|
||||
FROM base as check-license-headers
|
||||
FROM base AS check-license-headers
|
||||
RUN go get -u github.com/kunalkushwaha/ltag
|
||||
RUN --mount=target=. \
|
||||
make -f builder.Makefile check-license-headers
|
||||
|
||||
FROM base as check-go-mod
|
||||
FROM base AS make-go-mod-tidy
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
go mod tidy
|
||||
|
||||
FROM scratch AS go-mod-tidy
|
||||
COPY --from=make-go-mod-tidy /compose-cli/go.mod .
|
||||
COPY --from=make-go-mod-tidy /compose-cli/go.sum .
|
||||
|
||||
FROM base AS check-go-mod
|
||||
COPY . .
|
||||
RUN make -f builder.Makefile check-go-mod
|
||||
|
|
5
Makefile
5
Makefile
|
@ -92,6 +92,9 @@ moby-cli-link: ## Create com.docker.cli symlink if does not already exist
|
|||
validate-headers: ## Check license header for all files
|
||||
@docker build . --target check-license-headers
|
||||
|
||||
go-mod-tidy: ## Run go mod tidy in a container and output resulting go.mod and go.sum
|
||||
@docker build . --target go-mod-tidy --output .
|
||||
|
||||
validate-go-mod: ## Validate go.mod and go.sum are up-to-date
|
||||
@docker build . --target check-go-mod
|
||||
|
||||
|
@ -128,4 +131,4 @@ help: ## Show help
|
|||
|
||||
FORCE:
|
||||
|
||||
.PHONY: all validate protos cli e2e-local cross test cache-clear lint check-dependencies serve classic-link help clean-aci-e2e
|
||||
.PHONY: all validate protos cli e2e-local cross test cache-clear lint check-dependencies serve classic-link help clean-aci-e2e go-mod-tidy
|
||||
|
|
Loading…
Reference in New Issue