Skip to content
Merged
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
13 changes: 10 additions & 3 deletions .github/workflows/on-pull-request-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,27 @@ jobs:
docker exec sbx-boot /usr/sbin/sshd -T | grep -iEx 'permitrootlogin (prohibit-password|without-password|yes)'

# Drukbox builds the browser as a template: browser.sh run on the default
# image of its docker provider, which every druks deploy sets to the sandbox
# image above.
# image of its docker provider. The deployment sets that image, so browser.sh
# must build on drukbox's stock image and on the sandbox image above.
browser:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
base: [ghcr.io/czpython/drukbox/sandbox:latest, druks-sandbox:pr]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build the sandbox image
if: matrix.base == 'druks-sandbox:pr'
run: docker build --target sandbox --tag druks-sandbox:pr deploy/sandbox
- name: Build browser.sh the way Drukbox builds a template
env:
BASE: ${{ matrix.base }}
run: |
printf '%s\n' \
'FROM druks-sandbox:pr' \
"FROM $BASE" \
'COPY browser.sh /drukbox-setup.sh' \
'RUN sh /drukbox-setup.sh && rm /drukbox-setup.sh' \
| docker build --tag druks-browser:pr --file - backend/druks/browser/sandboxes
Expand Down
12 changes: 9 additions & 3 deletions backend/druks/browser/sandboxes/browser.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
# Drukbox builds this as root on the default image of its docker provider: the
# sandbox image (deploy/sandbox/Dockerfile), which has Node 22 and the druks user.
# Drukbox builds this as root on the default image of its docker provider. The
# deployment sets that image. It can be the sandbox image
# (deploy/sandbox/Dockerfile), which already has Node 22 and the druks user.
set -eu
export DEBIAN_FRONTEND=noninteractive
arch="$(dpkg --print-architecture)"
Expand All @@ -10,6 +11,10 @@ playwright_version=1.62.0
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl gnupg
install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --yes --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [arch=$arch signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" \
> /etc/apt/sources.list.d/nodesource.list
# Real Google Chrome, so the login browser presents Chrome's fingerprint and not
# Chromium's. A login gate reads the difference.
curl -fsSL https://dl.google.com/linux/linux_signing_key.pub \
Expand All @@ -19,7 +24,7 @@ echo "deb [arch=$arch signed-by=/etc/apt/keyrings/google-chrome.gpg] https://dl.
apt-get update
apt-get install -y --no-install-recommends \
fonts-liberation fonts-noto-cjk fonts-noto-color-emoji \
google-chrome-stable tzdata x11vnc xvfb
google-chrome-stable nodejs tzdata x11vnc xvfb
rm -rf /var/lib/apt/lists/*

install -d -m 0755 /opt/druks-browser
Expand All @@ -41,6 +46,7 @@ install -d -m 0755 /etc/opt/chrome/policies/managed
echo '{"CommandLineFlagSecurityWarningsEnabled": false}' \
> /etc/opt/chrome/policies/managed/druks.json

id druks >/dev/null 2>&1 || useradd --create-home --shell /bin/bash druks
install -d -m 0700 -o druks -g druks /work/session
# Xvfb runs as druks and cannot make this directory sticky itself.
install -d -m 1777 /tmp/.X11-unix
2 changes: 1 addition & 1 deletion backend/druks/browser/sandboxes/goss.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The boot contract of the browser template: the drukbox base entrypoint seeds
# the ``druks`` user of the sandbox image, and /work/session belongs to it.
# the ``druks`` user, and /work/session belongs to it.
# dgoss checks it in CI with DRUKBOX_SSH_USER=druks and
# DRUKBOX_AUTHORIZED_KEY="ssh-ed25519 AAAA goss".
file:
Expand Down
Loading