Skip to content

Commit 8918ee7

Browse files
committed
correct alpine update command
1 parent 5ecf25a commit 8918ee7

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,22 @@ internal/commands.gen.go: internal/commandsgen/commands.yml
1010
build:
1111
go build ./cmd/temporal
1212

13-
update-alpine:
14-
$(MAKE) -C .github/docker update-alpine
13+
update-alpine: ## Update Alpine base image to latest version and digest (usage: make update-alpine [ALPINE_TAG=3.22])
14+
@if [ -n "$(ALPINE_TAG)" ]; then \
15+
LATEST_TAG=$(ALPINE_TAG); \
16+
else \
17+
echo "Fetching latest Alpine version from Docker Hub..."; \
18+
LATEST_TAG=$$(curl -s https://registry.hub.docker.com/v2/repositories/library/alpine/tags\?page_size=100 | \
19+
jq -r '.results[].name' | grep -E '^3\.[0-9]+$$' | sort -V | tail -1); \
20+
fi && \
21+
echo "Alpine version: $$LATEST_TAG" && \
22+
DIGEST=$$(docker buildx imagetools inspect alpine:$$LATEST_TAG 2>/dev/null | grep "Digest:" | head -1 | awk '{print $$2}') && \
23+
DIGEST_HASH=$${DIGEST#sha256:} && \
24+
echo "Digest: sha256:$$DIGEST_HASH" && \
25+
ALPINE_FULL="alpine:$$LATEST_TAG@sha256:$$DIGEST_HASH" && \
26+
if sed --version 2>&1 | grep -q GNU; then \
27+
sed -i "s|default = \"alpine:[^\"]*\"|default = \"$$ALPINE_FULL\"|" .github/docker/docker-bake.hcl; \
28+
else \
29+
sed -i '' "s|default = \"alpine:[^\"]*\"|default = \"$$ALPINE_FULL\"|" .github/docker/docker-bake.hcl; \
30+
fi && \
31+
echo "Updated .github/docker/docker-bake.hcl with $$ALPINE_FULL"

0 commit comments

Comments
 (0)