Skip to content

Commit cda7edf

Browse files
committed
build(docker): add slim multi stage ubuntu headless shell image
1 parent 56015c1 commit cda7edf

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

.github/workflows/benches.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- name: Install Dependencies
2626
run: |
27-
sudo apt-get install -y --no-install-recommends curl unzip gpg ca-certificates git openssh-client && sudo apt-get update
27+
sudo apt-get install -y --no-install-recommends curl unzip ca-certificates git openssh-client && sudo apt-get update
2828
2929
- name: Install Rust
3030
run: |

.github/workflows/rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Install Dependencies
2828
run: |
29-
sudo apt-get install -y --no-install-recommends curl unzip gpg ca-certificates git openssh-client && sudo apt-get update
29+
sudo apt-get install -y --no-install-recommends curl unzip ca-certificates git openssh-client && sudo apt-get update
3030
3131
- name: Install Rust
3232
run: |

docker/Dockerfile.headless_shell_playwright

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
FROM mcr.microsoft.com/playwright:v1.50.1-noble AS rustbuilder
1+
FROM ubuntu:25.04 AS rustbuilder
22

33
WORKDIR /app
44

55
# Get Ubuntu packages
66
RUN apt-get update && apt-get install -y \
77
build-essential \
8-
bash
8+
bash curl \
9+
&& apt-get update
910

1011
COPY ../headless_browser/ ./headless_browser
1112
COPY ../headless_browser_lib/ ./headless_browser_lib
@@ -18,7 +19,7 @@ RUN rustup update stable
1819

1920
RUN RUST_LOG=error cargo install --no-default-features --path headless_browser
2021

21-
FROM mcr.microsoft.com/playwright:v1.50.1-noble
22+
FROM ubuntu:25.04 AS chromebuilder
2223

2324
ARG VERSION=latest
2425

@@ -27,10 +28,27 @@ COPY ../local.conf /etc/fonts/local.conf
2728

2829
RUN apt-get update && apt-get install -y \
2930
build-essential \
30-
tini curl
31+
tini curl gpg ca-certificates npm
3132

3233
RUN ./build-unpatched.sh
3334

35+
FROM ubuntu:25.04
36+
37+
ARG VERSION=latest
38+
39+
COPY ../local.conf /etc/fonts/local.conf
40+
41+
# https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/registry/nativeDeps.ts#L37
42+
RUN apt-get update && apt-get install --no-install-recommends -y \
43+
libasound2t64 tini curl ca-certificates libfreetype6 \
44+
libnspr4 libnss3 libexpat1 libgbm1 libfontconfig1 glib2.0 libatk1.0-0 \
45+
fonts-liberation fonts-noto-color-emoji libatspi2.0-0 \
46+
libc6 libcairo2 libcups2 libdbus-1-3 \
47+
libgcc1 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libpango-1.0-0 \
48+
libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
49+
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
50+
fonts-liberation libatk-bridge2.0-0 libdrm2 libjpeg-turbo8
51+
3452
# Add Chrome as a user
3553
RUN mkdir -p /usr/src/app \
3654
&& useradd -m chrome \
@@ -41,6 +59,7 @@ EXPOSE 9222 6000 9223
4159
USER root
4260

4361
COPY --from=rustbuilder /root/.cargo/bin/headless_browser /usr/local/bin/headless_browser
62+
COPY --from=chromebuilder /out/latest/headless-shell /out/latest/headless-shell/
4463
COPY ../scripts/docker-entrypoint.sh /
4564

4665
RUN chmod +x /docker-entrypoint.sh

0 commit comments

Comments
 (0)