From 6130748e17e926ed71c152dcf033cdbb08fa2b5e Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 13 Feb 2025 14:19:23 +0100 Subject: [PATCH] chore: restore load-image-json --- transport-interop/impl/js/v1.x/Makefile | 8 ++++++-- transport-interop/impl/js/v2.x/Makefile | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/transport-interop/impl/js/v1.x/Makefile b/transport-interop/impl/js/v1.x/Makefile index cd52beb6..20c05f34 100644 --- a/transport-interop/impl/js/v1.x/Makefile +++ b/transport-interop/impl/js/v1.x/Makefile @@ -3,18 +3,22 @@ image_name := js-v1.x # TODO Enable webkit once https://github.com/libp2p/js-libp2p/pull/1627 is in all: image.json chromium-image.json firefox-image.json update-lock-file +# Necessary because multistage builds require a docker image name rather than a digest to be used +load-image-json: image.json + docker image tag $$(jq -r .imageID image.json) ${image_name} + image.json: docker builder prune -af docker build -t node-${image_name} -f ./Dockerfile . docker image inspect node-${image_name} -f "{{.Id}}" | \ xargs -I {} echo "{\"imageID\": \"{}\"}" > $@ -chromium-image.json: image.json +chromium-image.json: load-image-json docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=node-${image_name} --build-arg=BROWSER=chromium -t chromium-${image_name} . docker image inspect chromium-${image_name} -f "{{.Id}}" | \ xargs -I {} echo "{\"imageID\": \"{}\"}" > $@ -firefox-image.json: image.json +firefox-image.json: load-image-json docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=node-${image_name} --build-arg=BROWSER=firefox -t firefox-${image_name} . docker image inspect firefox-${image_name} -f "{{.Id}}" | \ xargs -I {} echo "{\"imageID\": \"{}\"}" > $@ diff --git a/transport-interop/impl/js/v2.x/Makefile b/transport-interop/impl/js/v2.x/Makefile index 89504f6f..9f6bfca4 100644 --- a/transport-interop/impl/js/v2.x/Makefile +++ b/transport-interop/impl/js/v2.x/Makefile @@ -3,18 +3,22 @@ image_name := js-v2.x # TODO Enable webkit once https://github.com/libp2p/js-libp2p/pull/1627 is in all: image.json chromium-image.json firefox-image.json update-lock-file +# Necessary because multistage builds require a docker image name rather than a digest to be used +load-image-json: image.json + docker image tag $$(jq -r .imageID image.json) ${image_name} + image.json: docker builder prune -af docker build -t node-${image_name} -f ./Dockerfile . docker image inspect node-${image_name} -f "{{.Id}}" | \ xargs -I {} echo "{\"imageID\": \"{}\"}" > $@ -chromium-image.json: image.json +chromium-image.json: load-image-json docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=node-${image_name} --build-arg=BROWSER=chromium -t chromium-${image_name} . docker image inspect chromium-${image_name} -f "{{.Id}}" | \ xargs -I {} echo "{\"imageID\": \"{}\"}" > $@ -firefox-image.json: image.json +firefox-image.json: load-image-json docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=node-${image_name} --build-arg=BROWSER=firefox -t firefox-${image_name} . docker image inspect firefox-${image_name} -f "{{.Id}}" | \ xargs -I {} echo "{\"imageID\": \"{}\"}" > $@