public static BiPredicate<ServiceSpec, BuildContext> getBuildPushRequiredPredicate() {
        return (serviceSpec, context) -> {
            if (context != null) {
                if (BooleanUtils.toBoolean(context.isStackAsServiceImage())) {
                    return true;
                }
                if (context.getDockerfileEntity() != null && context.getDockerfileEntity().getDockerfile() != null) {
                    return true;
                }
            }
            if (serviceSpec == null) {
                return false;
            }
            Dockerfile dockerfile = null;
            try {
                dockerfile = serviceSpec.get(
                        HyscaleSpecFields.getPath(HyscaleSpecFields.image, HyscaleSpecFields.dockerfile),
                        Dockerfile.class);
            } catch (HyscaleException e) {
                return false;
            }

            return dockerfile != null;
        };
    }
Build or push required when:
User provides docker file, or tool generates dockerfile
In case of stack as service image need to pull and push the image
image-builder/builder-services/src/main/java/io/hyscale/builder/services/predicates/ImageBuilderPredicates.java