static void checkManifestPlatform(
      BuildContext buildContext, ContainerConfigurationTemplate containerConfig)
      throws PlatformNotFoundInBaseImageException {
    Optional<Path> path = buildContext.getBaseImageConfiguration().getTarPath();
    String baseImageName =
        path.map(Path::toString)
            .orElse(buildContext.getBaseImageConfiguration().getImage().toString());

    Set<Platform> platforms = buildContext.getContainerConfiguration().getPlatforms();
    Verify.verify(!platforms.isEmpty());

    if (platforms.size() != 1) {
      String msg =
          String.format(
              "cannot build for multiple platforms since the base image '%s' is not a manifest list.",
              baseImageName);
      throw new PlatformNotFoundInBaseImageException(msg);
    } else {
      Platform platform = platforms.iterator().next();
      if (!platform.getArchitecture().equals(containerConfig.getArchitecture())
          || !platform.getOs().equals(containerConfig.getOs())) {

        // Unfortunately, "platforms" has amd64/linux by default even if the user didn't explicitly
        // configure it. Skip reporting to suppress false alarm.
        if (!(platform.getArchitecture().equals("amd64") && platform.getOs().equals("linux"))) {
          String msg =
              String.format(
                  "the configured platform (%s/%s) doesn't match the platform (%s/%s) of the base image (%s)",
                  platform.getArchitecture(),
                  platform.getOs(),
                  containerConfig.getArchitecture(),
                  containerConfig.getOs(),
                  baseImageName);
          throw new PlatformNotFoundInBaseImageException(msg);
        }
      }
    }
  }
Assuming the base image is not a manifest list, checks and warns misconfigured platforms.

@param buildContext the {@link BuildContext}
@param containerConfig container configuration JSON of the base image
jib-core/src/main/java/com/google/cloud/tools/jib/builder/steps/PlatformChecker.java