mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-23 17:28:23 +00:00
fix: 🐛 update relayer's docker run logic to allow local images (#96)
This PR adds a quick check to see if the image to use for the relayer is a locally-built one (by checking that it ends with `:local`) and avoids pulling from Docker Hub if so. This fixes the issue in which we were unable to run the CLI with a local relayer image since it was always trying to pull from the corresponding repository which of course didn't exist for local images.
This commit is contained in:
parent
d2bf185bcc
commit
330bf1abec
4 changed files with 10 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "0.1.0-autogenerated.14950524012264222870",
|
||||
"version": "0.1.0-autogenerated.4891319136699380765",
|
||||
"name": "@polkadot-api/descriptors",
|
||||
"files": [
|
||||
"dist"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -240,6 +240,9 @@ export const initEthClientPallet = async (
|
|||
const addHostParam =
|
||||
process.platform === "linux" ? "--add-host host.docker.internal:host-gateway" : "";
|
||||
|
||||
// Opportunistic pull - pull the image from Docker Hub only if it's not a local image
|
||||
const isLocal = relayerImageTag.endsWith(":local");
|
||||
|
||||
logger.debug("Generating beacon checkpoint");
|
||||
const datastoreHostPath = path.resolve(datastorePath);
|
||||
const command = `docker run \
|
||||
|
|
@ -248,10 +251,10 @@ export const initEthClientPallet = async (
|
|||
-v ${datastoreHostPath}:/data \
|
||||
--name generate-beacon-checkpoint \
|
||||
--platform linux/amd64 \
|
||||
--pull always \
|
||||
--workdir /app \
|
||||
${addHostParam} \
|
||||
${launchedNetwork.networkName ? `--network ${launchedNetwork.networkName}` : ""} \
|
||||
${isLocal ? "" : "--pull always"} \
|
||||
${relayerImageTag} \
|
||||
generate-beacon-checkpoint --config beacon-relay.json --export-json`;
|
||||
logger.debug(`Running command: ${command}`);
|
||||
|
|
|
|||
|
|
@ -191,6 +191,9 @@ export const launchRelayers = async (options: LaunchOptions, launchedNetwork: La
|
|||
launchedNetwork
|
||||
);
|
||||
|
||||
// Opportunistic pull - pull the image from Docker Hub only if it's not a local image
|
||||
const isLocal = options.relayerImageTag.endsWith(":local");
|
||||
|
||||
for (const { configFilePath, name, config, pk } of relayersToStart) {
|
||||
try {
|
||||
const containerName = `snowbridge-${config.type}-relay`;
|
||||
|
|
@ -205,8 +208,6 @@ export const launchRelayers = async (options: LaunchOptions, launchedNetwork: La
|
|||
"docker",
|
||||
"run",
|
||||
"-d",
|
||||
"--pull",
|
||||
"always",
|
||||
"--platform",
|
||||
"linux/amd64",
|
||||
"--add-host",
|
||||
|
|
@ -214,7 +215,8 @@ export const launchRelayers = async (options: LaunchOptions, launchedNetwork: La
|
|||
"--name",
|
||||
containerName,
|
||||
"--network",
|
||||
networkName
|
||||
networkName,
|
||||
...(isLocal ? [] : ["--pull", "always"])
|
||||
];
|
||||
|
||||
const volumeMounts: string[] = ["-v", `${hostConfigFilePath}:${containerConfigFilePath}`];
|
||||
|
|
|
|||
Loading…
Reference in a new issue