public async createRunnableAppImage()

in src/ContainerAppHelper.ts [422:464]


    public async createRunnableAppImage(
        imageToDeploy: string,
        appSourcePath: string,
        environmentVariables: string[],
        builderStack?: string) {

        let telemetryArg = toolHelper.getTelemetryArg();
        if (this.disableTelemetry) {
            telemetryArg = `ORYX_DISABLE_TELEMETRY=true`;
        }

        let subscription = await this.getCurrentSubscription();

        let couldBuildImage = false;

        for (const builderImage of ORYX_BUILDER_IMAGES) {
            if (!util.isNullOrEmpty(builderStack) && !builderImage.includes(builderStack)) {
                continue;
            }

            toolHelper.writeDebug(`Attempting to create a runnable application image with name "${imageToDeploy}" using the Oryx++ Builder "${builderImage}"`);

            try {
                let command = `build ${imageToDeploy} --path ${appSourcePath} --builder ${builderImage} --env ${telemetryArg} --env BP_SUBSCRIPTION_ID=${subscription}`;
                environmentVariables.forEach(function (envVar: string) {
                    command += ` --env ${envVar}`;
                });

                await util.execute(`${PACK_CMD} ${command}`);
                couldBuildImage = true;
                break;
            } catch (err) {
                toolHelper.writeWarning(`Unable to run 'pack build' command to produce runnable application image: ${err.message}`);
            }
        };

        // If none of the builder images were able to build the provided application source, throw an error.
        if (!couldBuildImage) {
            const errorMessage = `No builder was able to build the provided application source. Please visit the following page for more information on supported platform versions: https://aka.ms/SourceToCloudSupportedVersions`;
            toolHelper.writeError(errorMessage);
            throw new Error(errorMessage);
        }
    }