2024-06-06 09:53:35 +00:00
|
|
|
image_name := js-v1.x
|
2024-05-23 00:53:31 +00:00
|
|
|
|
|
|
|
# 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}
|
|
|
|
|
|
|
|
chromium-image.json: load-image-json BrowserDockerfile
|
|
|
|
docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=${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: load-image-json BrowserDockerfile
|
|
|
|
docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=${image_name} --build-arg=BROWSER=firefox -t firefox-${image_name} .
|
|
|
|
docker image inspect firefox-${image_name} -f "{{.Id}}" | \
|
|
|
|
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
|
|
|
|
|
|
|
# We update the lock file here so that we make sure we are always using the correct lock file.
|
|
|
|
# If this changes, CI will fail since there are unstaged changes.
|
|
|
|
update-lock-file: image.json
|
|
|
|
CONTAINER_ID=$$(docker create $$(jq -r .imageID image.json)); \
|
|
|
|
docker cp $$CONTAINER_ID:/app/package-lock.json ./package-lock.json; \
|
|
|
|
docker rm $$CONTAINER_ID
|
|
|
|
|
|
|
|
image.json:
|
|
|
|
docker build -t ${image_name} -f ./Dockerfile .
|
|
|
|
docker image inspect ${image_name} -f "{{.Id}}" | \
|
|
|
|
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf image.json *-image.json
|
|
|
|
|
|
|
|
.PHONY: all clean browser-images load-image-json
|