private void validate(ServiceSpec serviceSpec, DockerfileGenContext context) throws HyscaleException {
        if (serviceSpec == null) {
            throw new HyscaleException(CommonErrorCode.SERVICE_SPEC_REQUIRED);
        }
        if (context == null) {
            throw new HyscaleException(DockerfileErrorCodes.FAILED_TO_PROCESS_DOCKERFILE_GENERATION);
        }
        
        Dockerfile userDockerfile = serviceSpec.get(
                HyscaleSpecFields.getPath(HyscaleSpecFields.image, HyscaleSpecFields.dockerfile), Dockerfile.class);
        BuildSpec buildSpec = serviceSpec
                .get(HyscaleSpecFields.getPath(HyscaleSpecFields.image, HyscaleSpecFields.buildSpec), BuildSpec.class);

        if (userDockerfile != null && buildSpec != null) {
            throw new HyscaleException(DockerfileErrorCodes.DOCKERFILE_OR_BUILDSPEC_REQUIRED);
        }
        
        if (buildSpec != null && StringUtils.isBlank(buildSpec.getStackImage())) {
            WorkflowLogger.startActivity(DockerfileActivity.DOCKERFILE_GENERATION);
            WorkflowLogger.endActivity(Status.FAILED);
            throw new HyscaleException(DockerfileErrorCodes.INVALID_STACK_IMAGE);
        }
    }
Validates service spec if dockerfile generation has to be skipped
Copies the artifacts to relative path of dockerfile
Copies the scripts to relative path of dockerfile
Generates the dockerfile content
Writes  dockerfile to a file
dockerfile-generator/dockerfile-gen-services/src/main/java/io/hyscale/dockerfile/gen/services/generator/impl/DockerfileGeneratorImpl.java