Skip to content

Commit eb27651

Browse files
committed
dockerfile: mod-outdated target to check modules updates
Signed-off-by: CrazyMax <[email protected]>
1 parent ba96bfb commit eb27651

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,8 @@ doctoc:
9191

9292
.PHONY: docs
9393
docs:
94-
$(BUILDX_CMD) bake docs
94+
$(BUILDX_CMD) bake docs
95+
96+
.PHONY: mod-outdated
97+
mod-outdated:
98+
$(BUILDX_CMD) bake mod-outdated

docker-bake.hcl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,11 @@ target "docs" {
167167
target = "update"
168168
output = ["./docs"]
169169
}
170+
171+
target "mod-outdated" {
172+
inherits = ["_common"]
173+
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
174+
target = "outdated"
175+
no-cache-filter = ["outdated"]
176+
output = ["type=cacheonly"]
177+
}

hack/dockerfiles/vendor.Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# syntax=docker/dockerfile-upstream:master
22

33
ARG GO_VERSION=1.20
4+
ARG MODOUTDATED_VERSION=v0.9.0
45

56
FROM golang:${GO_VERSION}-alpine AS base
67
RUN apk add --no-cache git rsync
@@ -35,3 +36,10 @@ RUN --mount=target=/context \
3536
exit 1
3637
fi
3738
EOT
39+
40+
FROM psampaz/go-mod-outdated:${MODOUTDATED_VERSION} AS go-mod-outdated
41+
FROM base AS outdated
42+
RUN --mount=target=.,rw \
43+
--mount=target=/go/pkg/mod,type=cache \
44+
--mount=from=go-mod-outdated,source=/usr/bin/go-mod-outdated,target=/usr/bin/go-mod-outdated \
45+
go list -mod=mod -u -m -json all | go-mod-outdated -update -direct

0 commit comments

Comments
 (0)