How to use the @nomiclabs/buidler-docker.BuidlerDocker.imageToRepoTag function in @nomiclabs/buidler-docker

To help you get started, we’ve selected a few @nomiclabs/buidler-docker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nomiclabs / buidler / packages / buidler-vyper / src / compilation.ts View on Github external
async function pullImageIfNecessary(
  docker: BuidlerDocker,
  image: Image,
  cachePath: string
) {
  if (!(await docker.hasPulledImage(image))) {
    console.log(
      `Pulling Docker image ${BuidlerDocker.imageToRepoTag(image)}...`
    );

    await docker.pullImage(image);

    console.log(`Image pulled`);
  } else {
    await checkForImageUpdates(docker, image, cachePath);
  }
}
github nomiclabs / buidler / packages / buidler-vyper / src / compilation.ts View on Github external
async function checkForImageUpdates(
  docker: BuidlerDocker,
  image: Image,
  cachePath: string
) {
  if (!(await shouldCheckForUpdates(image, cachePath))) {
    return;
  }

  if (!(await docker.isImageUpToDate(image))) {
    console.log(
      `Updating Docker image ${BuidlerDocker.imageToRepoTag(image)}...`
    );

    await docker.pullImage(image);

    console.log(`Image updated`);
  }

  await saveLastUpdateCheckDate(image, cachePath);
}
github nomiclabs / buidler / packages / buidler-vyper / src / compilation.ts View on Github external
async function getLastUpdateCheckDate(
  image: Image,
  cachePath: string
): Promise {
  const file = path.join(cachePath, VYPER_DOCKER_IMAGES_LAST_UPDATE_CHECK_FILE);
  if (!(await fsExtra.pathExists(file))) {
    return undefined;
  }

  const updates = await fsExtra.readJSON(file);
  return updates[BuidlerDocker.imageToRepoTag(image)];
}
github nomiclabs / buidler / packages / buidler-vyper / src / compilation.ts View on Github external
if (error instanceof DockerHubConnectionError) {
      throw new BuidlerPluginError(
        `Error connecting to Docker Hub.
Please check your internet connection.`,
        error
      );
    }

    if (error instanceof DockerServerError) {
      throw new BuidlerPluginError("Docker error", error);
    }

    if (error instanceof ImageDoesntExistError) {
      throw new BuidlerPluginError(
        `Docker image ${BuidlerDocker.imageToRepoTag(
          error.image
        )} doesn't exist.
Make sure you chose a valid Vyper version.`
      );
    }

    throw error;
  }
}
github nomiclabs / buidler / packages / buidler-vyper / src / compilation.ts View on Github external
async function saveLastUpdateCheckDate(image: Image, cachePath: string) {
  let updates: { [repoTag: string]: number };

  const file = path.join(cachePath, VYPER_DOCKER_IMAGES_LAST_UPDATE_CHECK_FILE);
  if (!(await fsExtra.pathExists(file))) {
    updates = {};
  } else {
    updates = await fsExtra.readJSON(file);
  }

  updates[BuidlerDocker.imageToRepoTag(image)] = +new Date();

  await fsExtra.ensureDir(path.dirname(file));
  await fsExtra.writeJSON(file, updates);
}

@nomiclabs/buidler-docker

A library to manage Docker from Buidler plugins

MIT
Latest version published 5 years ago

Package Health Score

70 / 100
Full package analysis