diff --git a/Dockerfile b/Dockerfile index a59b52b6a..fd96620e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,6 @@ ENV PUPPETEER_EXECUTABLE_PATH="${CHROMIUM_PATH}" # hadolint ignore=DL3044 ENV PATH="/node_modules/.bin:${PATH}" -RUN adduser -D sfdxhardis -USER sfdxhardis - ARG SFDX_CLI_VERSION=latest ARG SFDX_HARDIS_VERSION=latest diff --git a/defaults/puppeteer-config.json b/defaults/puppeteer-config.json new file mode 100644 index 000000000..9166615c9 --- /dev/null +++ b/defaults/puppeteer-config.json @@ -0,0 +1,6 @@ +{ + "args": [ + "--no-sandbox", + "--disable-setuid-sandbox" + ] +} \ No newline at end of file diff --git a/src/common/utils/mermaidUtils.ts b/src/common/utils/mermaidUtils.ts index 0e31eff24..db8e10e39 100644 --- a/src/common/utils/mermaidUtils.ts +++ b/src/common/utils/mermaidUtils.ts @@ -8,6 +8,7 @@ import { parseFlow } from "./flowVisualiser/flowParser.js"; import { getReportDirectory } from "../../config/index.js"; import moment from "moment"; import { SfError } from "@salesforce/core"; +import { PACKAGE_ROOT_DIR } from "../../settings.js"; let IS_MERMAID_AVAILABLE: boolean | null = null; @@ -40,7 +41,8 @@ export async function generateFlowMarkdownFile(flowName: string, flowXml: string export async function generateMarkdownFileWithMermaid(outputFlowMdFile: string): Promise { const isMmdAvailable = await isMermaidAvailable(); uxLog(this, c.grey(`Generating mermaidJs Graphs in ${outputFlowMdFile}...`)); - const mermaidCmd = `${!isMmdAvailable ? 'npx --yes -p @mermaid-js/mermaid-cli ' : ''}mmdc -i "${outputFlowMdFile}" -o "${outputFlowMdFile}" --puppeteer-config '{"args": ["--no-sandbox", "--disable-setuid-sandbox"]}'`; + const puppeteerConfigPath = path.join(PACKAGE_ROOT_DIR, 'defaults', 'puppeteer-config.json'); + const mermaidCmd = `${!isMmdAvailable ? 'npx --yes -p @mermaid-js/mermaid-cli ' : ''}mmdc -i "${outputFlowMdFile}" -o "${outputFlowMdFile}" --puppeteerConfigFile "${puppeteerConfigPath}"`; try { await execCommand(mermaidCmd, this, { output: false, fail: true, debug: false }); return true;