Skip to content
This repository was archived by the owner on Mar 10, 2024. It is now read-only.

Commit 053ad90

Browse files
committed
feat: #42 fixing process error
1 parent 0312ae9 commit 053ad90

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Dockerfile
2-
FROM node:16.18.1-alpine3.16
2+
FROM node:16.18.1-alpine
33

44
# create destination directory
55
WORKDIR /usr/src/website-shot
66

77
# update and install dependency
8-
RUN apk add --no-cache chromium wqy-zenhei --repository http://nl.alpinelinux.org/alpine/edge/testing
8+
RUN apk add --no-cache git chromium wqy-zenhei --repository http://nl.alpinelinux.org/alpine/edge/testing
99

1010
# copy package.json and install dependencies
1111
COPY package*.json /usr/src/website-shot/
@@ -22,5 +22,6 @@ ENV NUXT_HOST 0.0.0.0
2222
ENV NUXT_PORT 3000
2323
ENV PASSWORD_PROTECT 0
2424
ENV PASSWORD null
25+
ENV RUNNING_DOCKER 1
2526

2627
CMD [ "yarn", "start" ]

server-middleware/website-shot.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ app.post("/screenshot", async (req, res) => {
9797
launchOptions: {
9898
headless: true,
9999
args: ["--no-sandbox", "--disable-setuid-sandbox"],
100+
ignoreDefaultArgs: ["--disable-extensions"],
100101
product: "chrome",
101102
waitUntil: "load",
102103
},
@@ -107,7 +108,9 @@ app.post("/screenshot", async (req, res) => {
107108
},
108109
};
109110

110-
options.launchOptions.executablePath = "/usr/bin/chromium-browser";
111+
if (process.env.RUNNING_DOCKER === "1") {
112+
options.launchOptions.executablePath = "/usr/bin/chromium-browser";
113+
}
111114

112115
const mimeType = params.mimeType;
113116

0 commit comments

Comments
 (0)