Skip to content

Commit

Permalink
fix: improve "npx playwright install-deps" in frontend/dockerfile (#130)
Browse files Browse the repository at this point in the history
make build was broken on my Linux Mint 21  because of this line npm playwright install-deps chromium, asking for root password (it issues an su, even with user root, some security rules might be in play at kernel level).

The solution is to replace this line by an exhaustive apt-get install.
  • Loading branch information
Marc-AntoineA authored Jun 5, 2024
1 parent 0a3ec56 commit b50e422
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG USER_UID=1000
ARG USER_GID=${USER_UID}

# builder is the node service, only used to build project in prod
FROM node:lts as builder
FROM node:lts-bullseye as builder
ARG USER_UID
ARG USER_GID
RUN usermod --uid $USER_UID node && \
Expand All @@ -31,8 +31,19 @@ RUN --mount=type=cache,id=search-a-licious-npm-cache,target=/home/node/.npm,mode
npm install && \
npx playwright install
USER root
RUN --mount=type=cache,id=search-a-licious-apt-cache,target=/var/cache/apt \
npx playwright install-deps chromium
# Install the dependencies for playwright with chromium
# "npx playwright install-deps chromium" is broken on some hosts
# (see https://github.com/microsoft/playwright/issues/11165)
# We switched to direct "apt-get install" command
# Dependencies listed with: "npx playwright install-deps chromium --dry-run"
RUN --mount=type=cache,id=search-a-licious-apt-cache,target=/var/cache/apt \
apt-get update&& apt-get install -y --no-install-recommends libasound2 \
libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 \
libdrm2 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libwayland-client0 \
libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 \
libxrandr2 xvfb fonts-noto-color-emoji fonts-unifont libfontconfig1 libfreetype6 \
xfonts-cyrillic xfonts-scalable fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei \
fonts-tlwg-loma-otf fonts-freefont-ttf
USER node
# add local binaries to path
ENV PATH /opt/search-a-licious/node_modules/.bin:$PATH
Expand Down

0 comments on commit b50e422

Please sign in to comment.