fix(multidim): make js-libp2p builds reproducible (#288)
This commit is contained in:
parent
2218a12457
commit
43b67ccdba
|
@ -10,7 +10,7 @@ FROM mcr.microsoft.com/playwright
|
||||||
|
|
||||||
|
|
||||||
COPY --from=js-libp2p-base /app/ /app/
|
COPY --from=js-libp2p-base /app/ /app/
|
||||||
WORKDIR /app/interop
|
WORKDIR /app/node_modules/@libp2p/multidim-interop
|
||||||
# We install browsers here instead of the cached version so that we use the latest browsers at run time.
|
# We install browsers here instead of the cached version so that we use the latest browsers at run time.
|
||||||
# Ideally this would also be pinned, but playwright controls this, so there isn't much we can do about it.
|
# Ideally this would also be pinned, but playwright controls this, so there isn't much we can do about it.
|
||||||
# By installing here, we avoid installing it at test time.
|
# By installing here, we avoid installing it at test time.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# Here because we want to fetch the node_modules within docker so that it's
|
# Here because we want to fetch the node_modules within docker so that it's
|
||||||
# installed on the same platform the test is run. Otherwise tools like `esbuild` will fail to run
|
# installed on the same platform the test is run. Otherwise tools like `esbuild` will fail to run
|
||||||
FROM node:18
|
FROM node:18.17.1
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
RUN apt-get update && apt-get install -y cmake
|
||||||
RUN npm i && npm run build
|
COPY package*.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
WORKDIR /app/interop
|
WORKDIR /app/node_modules/@libp2p/multidim-interop
|
||||||
RUN npm i && npm run build
|
|
||||||
|
|
||||||
ENTRYPOINT [ "npm", "run", "test:interop:multidim", "--", "--build", "false", "--types", "false", "-t", "node" ]
|
ENTRYPOINT [ "npm", "run", "test:interop:multidim", "--", "--build", "false", "--types", "false", "-t", "node" ]
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
image_name := js-v0.46
|
image_name := js-v0.46.9
|
||||||
commitSha := b7e608998cc88860d9ec8a3ed7c03fdfb3eccb3b
|
|
||||||
|
|
||||||
# TODO Enable webkit once https://github.com/libp2p/js-libp2p/pull/1627 is in
|
# TODO Enable webkit once https://github.com/libp2p/js-libp2p/pull/1627 is in
|
||||||
all: image.json chromium-image.json firefox-image.json
|
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
|
# Necessary because multistage builds require a docker image name rather than a digest to be used
|
||||||
load-image-json: image.json
|
load-image-json: image.json
|
||||||
|
@ -18,17 +17,20 @@ firefox-image.json: load-image-json BrowserDockerfile
|
||||||
docker image inspect firefox-${image_name} -f "{{.Id}}" | \
|
docker image inspect firefox-${image_name} -f "{{.Id}}" | \
|
||||||
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
||||||
|
|
||||||
image.json: js-libp2p-${commitSha}
|
# We update the lock file here so that we make sure we are always using the correct lock file.
|
||||||
cd js-libp2p-${commitSha} && docker build -t ${image_name} -f ../Dockerfile .
|
# 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}}" | \
|
docker image inspect ${image_name} -f "{{.Id}}" | \
|
||||||
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
||||||
|
|
||||||
js-libp2p-${commitSha}:
|
|
||||||
wget -O js-libp2p-${commitSha}.zip "https://github.com/libp2p/js-libp2p/archive/${commitSha}.zip"
|
|
||||||
unzip -o js-libp2p-${commitSha}.zip
|
|
||||||
unzip -o js-libp2p-${commitSha}.zip
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf image.json js-libp2p-*.zip js-libp2p-* *-image.json
|
rm -rf image.json *-image.json
|
||||||
|
|
||||||
.PHONY: all clean browser-images load-image-json
|
.PHONY: all clean browser-images load-image-json
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"@libp2p/multidim-interop": "1.0.0-c4eff4c5"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"@chainsafe/libp2p-noise": "13.0.1",
|
||||||
|
"@chainsafe/libp2p-yamux": "5.0.0",
|
||||||
|
"@libp2p/mplex": "9.0.5",
|
||||||
|
"@libp2p/tcp": "8.0.5",
|
||||||
|
"@libp2p/webrtc": "3.1.9",
|
||||||
|
"@libp2p/websockets": "7.0.5",
|
||||||
|
"@libp2p/webtransport": "3.0.9",
|
||||||
|
"@multiformats/mafmt": "12.1.6",
|
||||||
|
"@multiformats/multiaddr": "12.1.7",
|
||||||
|
"aegir": "40.0.12",
|
||||||
|
"libp2p": "0.46.9",
|
||||||
|
"redis": "4.6.8"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue