Skip to content

Commit 61d9b34

Browse files
committed
change workable on Docker
1 parent 7b0416b commit 61d9b34

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ RUN chown -R appuser:appgroup /app
3232
# Install *only* the production dependencies
3333
RUN npm ci --ignore-scripts --omit-dev
3434

35+
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
36+
37+
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
38+
3539
# Now, switch to running as our non-root user for the actual app process
3640
USER appuser
3741

src/tools/createRichMenu.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ async function generateRichMenuImage(
205205
await fsp.writeFile(tempHtmlPath, htmlContent, "utf8");
206206

207207
// 4. Use puppeteer to convert HTML to PNG
208-
const browser = await puppeteer.launch();
208+
const browser = await puppeteer.launch({
209+
args: ["--no-sandbox", "--disable-setuid-sandbox"],
210+
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH,
211+
});
209212
const page = await browser.newPage();
210213
await page.setViewport({ width: RICHMENU_WIDTH, height: RICHMENU_HEIGHT });
211214
await page.goto(`file://${tempHtmlPath}`, {

0 commit comments

Comments
 (0)