Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions images/chromium-headful/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARG NEKO_IMAGE=ghcr.io/kernel/neko/base:3.0.8-v1.6.0

FROM docker.io/golang:1.25.0 AS server-builder
WORKDIR /workspace/server

Expand Down Expand Up @@ -70,7 +72,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=$CACHEIDPREFIX-ap
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache; \
apt-get update; \
apt-get --no-install-recommends -y install \
git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev;
git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \
libwayland-dev wayland-protocols;
COPY images/chromium-headful/xorg-deps/ /xorg/
# build xf86-video-dummy v0.3.8 with RandR support
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=$CACHEIDPREFIX-apt-cache \
Expand All @@ -92,6 +95,20 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=$CACHEIDPREFIX-ap
make -j$(nproc); \
make install;

# Build the Weston-native Wayland capture helper. It uses Weston's
# screenshooter protocol and a persistent wl_shm buffer, avoiding X11 capture.
COPY images/chromium-headful/weston-capture/ /weston-capture/
RUN set -eux; \
wayland-scanner client-header /weston-capture/weston-screenshooter.xml \
/weston-capture/weston-screenshooter-client-protocol.h; \
wayland-scanner private-code /weston-capture/weston-screenshooter.xml \
/weston-capture/weston-screenshooter-protocol.c; \
gcc -O2 -Wall -Wextra -Werror -o /usr/local/bin/weston-capture \
/weston-capture/weston-capture.c \
/weston-capture/weston-screenshooter-protocol.c \
$(pkg-config --cflags --libs wayland-client); \
strip /usr/local/bin/weston-capture;

FROM docker.io/ubuntu:22.04 AS ffmpeg-downloader

# Allow cross-compilation when building with BuildKit platforms
Expand Down Expand Up @@ -161,7 +178,7 @@ RUN --mount=type=cache,target=/tmp/cache/ffmpeg,sharing=locked,id=$CACHEIDPREFIX
rm -rf /tmp/ffmpeg*
EOT

FROM ghcr.io/kernel/neko/base:3.0.8-v1.6.0 AS neko
FROM ${NEKO_IMAGE} AS neko
FROM node:22-bullseye-slim AS node-22
FROM docker.io/ubuntu:22.04

Expand Down Expand Up @@ -189,6 +206,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=$CACHEIDPREFIX-ap
imagemagick \
sudo \
mutter \
weston \
curl \
# Network tools
net-tools \
Expand Down Expand Up @@ -344,10 +362,13 @@ ENV WITHDOCKER=true

COPY images/chromium-headful/xorg.conf /etc/neko/xorg.conf
COPY images/chromium-headful/neko.yaml /etc/neko/neko.yaml
COPY images/chromium-headful/start-neko.sh /usr/local/bin/start-neko.sh
RUN chmod +x /usr/local/bin/start-neko.sh
COPY --from=neko /usr/bin/neko /usr/bin/neko
COPY --from=client /src/dist/ /var/www
COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/xorg/modules/drivers/dummy_drv.so
COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so
COPY --from=xorg-deps /usr/local/bin/weston-capture /usr/local/bin/weston-capture

COPY shared/start-pulseaudio.sh /usr/local/bin/start-pulseaudio.sh
RUN chmod +x /usr/local/bin/start-pulseaudio.sh
Expand Down
2 changes: 2 additions & 0 deletions images/chromium-headful/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mkdir -p "$HOST_RECORDINGS_DIR"

# RUN_AS_ROOT defaults to false in docker
RUN_AS_ROOT="${RUN_AS_ROOT:-false}"
DISPLAY_BACKEND="${DISPLAY_BACKEND:-x11}"

# Build Chromium flags file and mount
CHROMIUM_FLAGS_DEFAULT="--user-data-dir=/home/kernel/user-data --disable-dev-shm-usage --disable-gpu --start-maximized --disable-software-rasterizer --remote-allow-origins=*"
Expand Down Expand Up @@ -65,6 +66,7 @@ RUN_ARGS=(
-e WIDTH=1920
-e TZ=${TZ:-'America/Los_Angeles'}
-e RUN_AS_ROOT="$RUN_AS_ROOT"
-e DISPLAY_BACKEND="$DISPLAY_BACKEND"
--mount type=bind,src="$FLAGS_FILE",dst=/chromium/flags
)

Expand Down
2 changes: 2 additions & 0 deletions images/chromium-headful/run-unikernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ volume_name="${NAME}-flags"
# volume which we then mount into the image at /chromium.
# RUN_AS_ROOT defaults to true in unikernel (for now, until we figure it out)
RUN_AS_ROOT="${RUN_AS_ROOT:-true}"
DISPLAY_BACKEND="${DISPLAY_BACKEND:-x11}"

chromium_flags_default="--user-data-dir=/home/kernel/user-data --disable-dev-shm-usage --disable-gpu --start-maximized --disable-software-rasterizer --remote-allow-origins=*"
if [[ "$RUN_AS_ROOT" == "true" ]]; then
Expand Down Expand Up @@ -76,6 +77,7 @@ deploy_args=(
-e WIDTH=1920
-e TZ=${TZ:-'America/Los_Angeles'}
-e RUN_AS_ROOT="$RUN_AS_ROOT"
-e DISPLAY_BACKEND="$DISPLAY_BACKEND"
-e LOG_CDP_MESSAGES=true
-v "$volume_name":/chromium
-n "$NAME"
Expand Down
10 changes: 10 additions & 0 deletions images/chromium-headful/start-neko.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ "${DISPLAY_BACKEND:-x11}" = "wayland" ]; then
export NEKO_DESKTOP_WAYLAND=true
export NEKO_CAPTURE_VIDEO_WAYLAND=true
export NEKO_CAPTURE_VIDEO_WAYLAND_RECORDER=/usr/local/bin/weston-capture
fi

exec /usr/bin/neko serve --server.static /var/www --server.bind 0.0.0.0:8080
2 changes: 1 addition & 1 deletion images/chromium-headful/supervisor/services/neko.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[program:neko]
command=/usr/bin/neko serve --server.static /var/www --server.bind 0.0.0.0:8080
command=/usr/local/bin/start-neko.sh
autostart=false
autorestart=true
startsecs=0
Expand Down
8 changes: 8 additions & 0 deletions images/chromium-headful/supervisor/services/weston.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[program:weston]
command=/bin/bash -c 'exec weston --backend=headless-backend.so --use-pixman --debug --shell=desktop-shell.so --socket="${WAYLAND_DISPLAY:-wayland-0}" --width="${WIDTH:-1920}" --height="${HEIGHT:-1080}" --idle-time=0'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desktop shell restores window chrome

Medium Severity

Switching Weston from kiosk-shell.so to desktop-shell.so drops the always-fullscreen kiosk behavior. Desktop shell defaults to a top panel and window decorations, so Chromium no longer fills the configured WIDTH×HEIGHT output. Compositor capture then includes that chrome, and CDP viewport size can fall short of the intended display (for example 1920×1024 versus 1920×1080).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c415be4. Configure here.

autostart=false
autorestart=true
startsecs=0
stdout_logfile=/var/log/supervisord/weston
redirect_stderr=true
user=kernel
Loading
Loading