54 - Resolve Playwright Chromium libraries via nix-ld
This commit is contained in:
parent
dcfa73b7db
commit
175290b707
3 changed files with 31 additions and 2 deletions
|
|
@ -9,7 +9,18 @@ RUN apk add --no-cache \
|
||||||
mysql-client \
|
mysql-client \
|
||||||
vim \
|
vim \
|
||||||
bash \
|
bash \
|
||||||
nano
|
nano \
|
||||||
|
chromium \
|
||||||
|
nss \
|
||||||
|
freetype \
|
||||||
|
harfbuzz \
|
||||||
|
ttf-freefont \
|
||||||
|
font-noto-emoji
|
||||||
|
|
||||||
|
# Playwright ships glibc-linked browser builds that do not run on Alpine (musl),
|
||||||
|
# so drive Alpine's own Chromium instead of downloading one.
|
||||||
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \
|
||||||
|
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||||
|
|
||||||
# Install PHP extensions including xdebug for development
|
# Install PHP extensions including xdebug for development
|
||||||
RUN install-php-extensions \
|
RUN install-php-extensions \
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ services:
|
||||||
|
|
||||||
# Vite
|
# Vite
|
||||||
VITE_HOST: "0.0.0.0"
|
VITE_HOST: "0.0.0.0"
|
||||||
|
|
||||||
|
# Playwright drives Alpine's system Chromium (musl); see Dockerfile.dev
|
||||||
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
|
||||||
|
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH: "/usr/bin/chromium-browser"
|
||||||
volumes:
|
volumes:
|
||||||
# Mount entire project for hot reload with SELinux context
|
# Mount entire project for hot reload with SELinux context
|
||||||
- ../..:/app:Z
|
- ../..:/app:Z
|
||||||
|
|
|
||||||
14
shell.nix
14
shell.nix
|
|
@ -1,5 +1,17 @@
|
||||||
{ pkgs ? import <nixpkgs> {} }:
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Playwright's bundled Chromium is a prebuilt glibc binary. NixOS has no
|
||||||
|
# /usr/lib, so nix-ld (enabled system-wide) resolves its interpreter and
|
||||||
|
# NIX_LD_LIBRARY_PATH supplies the libraries below.
|
||||||
|
chromiumLibs = with pkgs; [
|
||||||
|
glib nss nspr atk at-spi2-atk at-spi2-core cups dbus expat
|
||||||
|
xorg.libxcb libxkbcommon alsa-lib libgbm mesa
|
||||||
|
xorg.libX11 xorg.libXext xorg.libXcomposite xorg.libXdamage
|
||||||
|
xorg.libXfixes xorg.libXrandr cairo pango systemd libdrm
|
||||||
|
];
|
||||||
|
in
|
||||||
|
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
# PHP and tools
|
# PHP and tools
|
||||||
|
|
@ -29,6 +41,8 @@ pkgs.mkShell {
|
||||||
# Use keep-id for proper permission mapping in rootless podman
|
# Use keep-id for proper permission mapping in rootless podman
|
||||||
export PODMAN_USERNS=keep-id
|
export PODMAN_USERNS=keep-id
|
||||||
|
|
||||||
|
export NIX_LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath chromiumLibs}:$NIX_LD_LIBRARY_PATH"
|
||||||
|
|
||||||
# Compose file location
|
# Compose file location
|
||||||
COMPOSE_FILE="$PWD/docker/dev/docker-compose.yml"
|
COMPOSE_FILE="$PWD/docker/dev/docker-compose.yml"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue