Skip to content

Commit 3f2a120

Browse files
committed
fix: switch again because playwright does not manage proper install into alpine images, better to rely on official package even if version not aligned exactly
1 parent d46836e commit 3f2a120

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

Dockerfile

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ARG NODE_VERSION=18.19.0
55
ARG RUBY_VERSION=3.2.2-r1
66
ARG PIP_VERSION=23.3.1-r0
77
ARG PRISMA_VERSION=4.16.2
8-
ARG PLAYWRIGHT_VERSION=1.39.0
98
ARG APP_HOST=172.17.0.2
109
ARG PORT=3000
1110

@@ -14,18 +13,33 @@ FROM node:${NODE_VERSION}-alpine
1413
ARG RUBY_VERSION
1514
ARG PIP_VERSION
1615
ARG PRISMA_VERSION
17-
ARG PLAYWRIGHT_VERSION
1816
ARG APP_HOST
1917
ARG PORT
2018

21-
RUN apk add --no-cache \
19+
USER root
20+
21+
RUN apk add \
22+
# This is for the code we manage
2223
"build-base" \
2324
"libffi-dev" \
2425
"libcurl" \
2526
"curl" \
2627
"ruby-dev=${RUBY_VERSION}" \
27-
"py3-pip=${PIP_VERSION}"
28-
RUN apk update
28+
"py3-pip=${PIP_VERSION}" \
29+
# This is the dependencies needed by chromium
30+
"chromium" \
31+
"libstdc++" \
32+
"harfbuzz" \
33+
"nss" \
34+
"freetype" \
35+
"ttf-freefont" \
36+
"font-noto-emoji" \
37+
"wqy-zenhei"
38+
39+
ENV CHROME_BIN="/usr/bin/chromium-browser"
40+
ENV CHROME_PATH="/usr/lib/chromium/"
41+
42+
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH="${CHROME_BIN}"
2943

3044
# Restrict the permissions
3145

@@ -60,9 +74,6 @@ RUN python3 -m venv ./venv \
6074

6175
ENV PATH="/app/venv/bin:$PATH"
6276

63-
# We use `npx` to install browsers needed to avoid using `npm run playwright install --with-deps chromium` since we build as standalone the entire application and we no longer want to rely application `node_modules` folder
64-
RUN npx --yes playwright@${PLAYWRIGHT_VERSION} install --with-deps chromium
65-
6677
# Manage the final server build
6778

6879
COPY --chown=nextjs:nodejs ".next/standalone" ./

src/features/domain.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,9 @@ export async function updateWebsiteDataOnDomains() {
512512
},
513513
});
514514

515-
const browser = await chromium.launch();
515+
const browser = await chromium.launch({
516+
executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
517+
});
516518
try {
517519
for (const [rawDomainIndex, rawDomain] of Object.entries(rawDomains)) {
518520
watchGracefulExitInLoop();

0 commit comments

Comments
 (0)