Skip to content

Instantly share code, notes, and snippets.

@jumoog
Created February 13, 2025 21:00
Show Gist options
  • Save jumoog/69ae4f27d950f2a18490c22273e17933 to your computer and use it in GitHub Desktop.
Save jumoog/69ae4f27d950f2a18490c22273e17933 to your computer and use it in GitHub Desktop.
uBO Lite (uBOL) Layer for puppeteer with full permissions and no setup screen
FROM alpine:latest AS ublock
# Install required tools: curl, jq, and unzip
RUN apk --no-cache add curl jq unzip
# Set environment variables
ENV REPO_API="https://api.github.com/repos/uBlockOrigin/uBOL-home/releases/latest"
ENV FILE_PATTERN="chromium.mv3.zip"
# Create a working directory
WORKDIR /build
# Download and extract the latest release file
RUN download_url=$(curl -s $REPO_API | jq -r ".assets[] | select(.name | endswith(\"$FILE_PATTERN\")) | .browser_download_url") && \
if [ -z "$download_url" ]; then \
echo "No file matching '*.$FILE_PATTERN' found in the latest release." && exit 1; \
fi && \
curl -L -o latest_chromium_mv3.zip "$download_url" && \
unzip *.zip && rm -rf *.zip
# Patch permissions from optional_host_permissions to host_permissions to have full filter and no setup screen
RUN jq 'if has("optional_host_permissions") then .host_permissions = .optional_host_permissions | del(.optional_host_permissions) else . end' manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json
# COPY --from=ublock /build/ /uBlock0.chromium
# puppeteer args
# "--disable-extensions-except=/uBlock0.chromium",
# "--load-extension=/uBlock0.chromium"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment