From f84f55836715ed1e5d7fb1e8c64ececda200ce6c Mon Sep 17 00:00:00 2001 From: pupilcc Date: Fri, 18 Oct 2024 00:50:52 +0800 Subject: [PATCH] build: fix chrome --- dockerfile | 1 + src/application/archive.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfile b/dockerfile index 3f498c5..286ab2f 100644 --- a/dockerfile +++ b/dockerfile @@ -6,6 +6,7 @@ COPY . . RUN pnpm run build:ts FROM node:20-alpine +RUN apk update && apk add --no-cache chromium WORKDIR /app COPY package.json pnpm-lock.yaml ./ COPY --from=build /app/dist ./dist diff --git a/src/application/archive.ts b/src/application/archive.ts index ad12e37..ed56348 100644 --- a/src/application/archive.ts +++ b/src/application/archive.ts @@ -22,7 +22,7 @@ export async function generateHTML(id:string, url: string): Promise { const outputPath = path.join(__dirname, '../temp', filename) // Execute single-file-cli - await execAsync(`single-file ${url} "${outputPath}"`) + await execAsync(`single-file --browser-executable-path=/usr/bin/chromium-browser ${url} "${outputPath}"`) // Read the generated file const fileContent = await fs.promises.readFile(outputPath)