get docker image down to 630mb
Some checks failed
CodeQL / Analyze (python) (push) Waiting to run
Build Debian package / build (push) Waiting to run
Deploy static content to Pages / deploy (push) Waiting to run
Build Homebrew package / build (push) Waiting to run
Build GitHub Pages website / build (push) Waiting to run
Build GitHub Pages website / deploy (push) Blocked by required conditions
Run linters / lint (push) Waiting to run
Build Pip package / build (push) Waiting to run
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Waiting to run
Run tests / docker_tests (push) Waiting to run
Build Docker image / buildx (push) Has been cancelled

This commit is contained in:
Nick Sweeting 2024-12-18 05:03:52 -08:00
parent 54d4d7f640
commit 839016b4b1
No known key found for this signature in database
2 changed files with 19 additions and 18 deletions

View file

@ -147,7 +147,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T
echo "[+] APT Installing extractor dependencies for $TARGETPLATFORM..." \ echo "[+] APT Installing extractor dependencies for $TARGETPLATFORM..." \
&& apt-get update -qq \ && apt-get update -qq \
&& apt-get install -qq -y --no-install-recommends \ && apt-get install -qq -y --no-install-recommends \
git ffmpeg ripgrep \ git ripgrep \
# Packages we have also needed in the past: # Packages we have also needed in the past:
# youtube-dl wget2 aria2 python3-pyxattr rtmpdump libfribidi-bin mpv \ # youtube-dl wget2 aria2 python3-pyxattr rtmpdump libfribidi-bin mpv \
# curl wget (already installed above) # curl wget (already installed above)
@ -157,7 +157,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T
which curl && curl --version | head -n1 \ which curl && curl --version | head -n1 \
&& which wget && wget --version 2>&1 | head -n1 \ && which wget && wget --version 2>&1 | head -n1 \
&& which git && git --version 2>&1 | head -n1 \ && which git && git --version 2>&1 | head -n1 \
&& which ffmpeg && (ffmpeg --version 2>&1 | head -n1) || true \ # && which ffmpeg && (ffmpeg --version 2>&1 | head -n1) || true \
&& which rg && rg --version 2>&1 | head -n1 \ && which rg && rg --version 2>&1 | head -n1 \
&& echo -e '\n\n' \ && echo -e '\n\n' \
) | tee -a /VERSION.txt ) | tee -a /VERSION.txt
@ -260,31 +260,30 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T
# Install apt font & rendering dependencies for chromium browser # Install apt font & rendering dependencies for chromium browser
# TODO: figure out how much of this overlaps with `playwright install-deps chromium` # TODO: figure out how much of this overlaps with `playwright install-deps chromium`
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$TARGETVARIANT \
# Install chromium browser binary using playwright
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$TARGETVARIANT \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$TARGETVARIANT \
--mount=type=cache,target=/root/.cache/ms-playwright,sharing=locked,id=browsers-$TARGETARCH$TARGETVARIANT \
--mount=type=cache,target=/root/.cache/uv,sharing=locked,id=uv-$TARGETARCH$TARGETVARIANT \
echo "[+] APT Installing CHROMIUM dependencies, fonts, and display libraries for $TARGETPLATFORM..." \ echo "[+] APT Installing CHROMIUM dependencies, fonts, and display libraries for $TARGETPLATFORM..." \
&& apt-get update -qq \ && apt-get update -qq \
&& apt-get install -qq -y \ && apt-get install -qq -y \
fontconfig fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-symbola fonts-noto fonts-freefont-ttf \ #fontconfig fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-symbola fonts-noto fonts-freefont-ttf \
at-spi2-common fonts-liberation fonts-noto-color-emoji fonts-tlwg-loma-otf fonts-unifont libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libavahi-client3 \ #at-spi2-common fonts-liberation fonts-noto-color-emoji fonts-tlwg-loma-otf fonts-unifont libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libavahi-client3 \
libavahi-common-data libavahi-common3 libcups2 libfontenc1 libice6 libnspr4 libnss3 libsm6 libunwind8 \ #libavahi-common-data libavahi-common3 libcups2 libfontenc1 libice6 libnspr4 libnss3 libsm6 libunwind8 \
libxaw7 libxcomposite1 libxdamage1 libxfont2 \ #libxaw7 libxcomposite1 libxdamage1 libxfont2 \
libxkbfile1 libxmu6 libxpm4 libxt6 x11-xkb-utils x11-utils xfonts-encodings \ libxkbfile1 libxmu6 libxpm4 libxt6 x11-xkb-utils x11-utils xfonts-encodings \
# xfonts-scalable xfonts-utils xserver-common xvfb \ # xfonts-scalable xfonts-utils xserver-common xvfb \
# chrome can run without dbus/upower technically, it complains about missing dbus but should run ok anyway # chrome can run without dbus/upower technically, it complains about missing dbus but should run ok anyway
# libxss1 dbus dbus-x11 upower \ # libxss1 dbus dbus-x11 upower \
# && service dbus start \ # && service dbus start \
&& rm -rf /var/lib/apt/lists/* && echo "[+] PIP Installing playwright into /venv and CHROMIUM binary into $PLAYWRIGHT_BROWSERS_PATH..." \
# Install chromium browser binary using playwright
RUN --mount=type=cache,target=/root/.cache/ms-playwright,sharing=locked,id=browsers-$TARGETARCH$TARGETVARIANT \
# --mount=type=cache,target=/root/.cache/pip,sharing=locked,id=pip-$TARGETARCH$TARGETVARIANT \
--mount=type=cache,target=/root/.cache/uv,sharing=locked,id=uv-$TARGETARCH$TARGETVARIANT \
echo "[+] PIP Installing playwright into /venv and CHROMIUM binary into $PLAYWRIGHT_BROWSERS_PATH..." \
&& uv pip install "playwright>=1.49.1" \ && uv pip install "playwright>=1.49.1" \
&& uv run playwright install chromium --no-shell \ && uv run playwright install chromium --no-shell --with-deps \
# --with-deps \
&& export CHROME_BINARY="$(uv run python -c 'from playwright.sync_api import sync_playwright; print(sync_playwright().start().chromium.executable_path)')" \ && export CHROME_BINARY="$(uv run python -c 'from playwright.sync_api import sync_playwright; print(sync_playwright().start().chromium.executable_path)')" \
&& ln -s "$CHROME_BINARY" /usr/bin/chromium-browser \ && ln -s "$CHROME_BINARY" /usr/bin/chromium-browser \
&& ln -s /browsers/ffmpeg-*/ffmpeg-linux /usr/bin/ffmpeg \
&& mkdir -p "/home/${ARCHIVEBOX_USER}/.config/chromium/Crash Reports/pending/" \ && mkdir -p "/home/${ARCHIVEBOX_USER}/.config/chromium/Crash Reports/pending/" \
&& chown -R "$DEFAULT_PUID:$DEFAULT_PGID" "/home/${ARCHIVEBOX_USER}/.config" \ && chown -R "$DEFAULT_PUID:$DEFAULT_PGID" "/home/${ARCHIVEBOX_USER}/.config" \
&& mkdir -p "$PLAYWRIGHT_BROWSERS_PATH" \ && mkdir -p "$PLAYWRIGHT_BROWSERS_PATH" \
@ -292,10 +291,11 @@ RUN --mount=type=cache,target=/root/.cache/ms-playwright,sharing=locked,id=brows
# delete extra full copy of node that playwright installs (saves >100mb) # delete extra full copy of node that playwright installs (saves >100mb)
&& rm -f /venv/lib/python$PYTHON_VERSION/site-packages/playwright/driver/node \ && rm -f /venv/lib/python$PYTHON_VERSION/site-packages/playwright/driver/node \
# Save version info # Save version info
&& rm -rf /var/lib/apt/lists/* \
&& ( \ && ( \
uv pip show playwright \ uv pip show playwright \
# && uv run playwright --version \
&& which chromium-browser && /usr/bin/chromium-browser --version || /usr/lib/chromium/chromium --version \ && which chromium-browser && /usr/bin/chromium-browser --version || /usr/lib/chromium/chromium --version \
&& which ffmpeg && ffmpeg -version \
&& echo -e '\n\n' \ && echo -e '\n\n' \
) | tee -a /VERSION.txt ) | tee -a /VERSION.txt

View file

@ -35,13 +35,14 @@ cd blobs/sha256 || exit 1
for LAYERFILE in ./*; do for LAYERFILE in ./*; do
if [ -f "${LAYERFILE}" ]; then if [ -f "${LAYERFILE}" ]; then
mv "${LAYERFILE}" "${LAYERFILE}.tar" mv "${LAYERFILE}" "${LAYERFILE}.tar"
tar -xzf "${LAYERFILE}.tar" mkdir -p "${LAYERFILE}"
tar -xzf "${LAYERFILE}.tar" -C "${LAYERFILE}"
rm "${LAYERFILE}.tar" rm "${LAYERFILE}.tar"
echo "-----------------------------------------------------------------" echo "-----------------------------------------------------------------"
echo "Contents of layer: ${LAYERFILE%/}" echo "Contents of layer: ${LAYERFILE%/}"
echo "-----------------------------------------------------------------" echo "-----------------------------------------------------------------"
# List the files in the layer.tar without extracting # List the files in the layer.tar without extracting
tree -L 2 tree -L 2 "${LAYERFILE}"
echo echo
fi fi
done done