Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ add chromium via apt-get #627

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

effendiian
Copy link

Chromium Installation via apt-get Package Manager

This pull request introduces one new feature for installing Chromium, for use as a headless browser, in devcontainers:

  • Installs Chromium using the apt-get package manager and the release from the xtradeb/apps PPA repository.
  • Leverages the apt-get-packages feature, which is already a part of the devcontainers-contrib/features index.

Example usage in a devcontainer configuration:

"features": {
	"ghcr.io/devcontainers-contrib/features/chromium-apt-get:1": {},
}

🔗 Resolves

This pull request affects the following issues:

📖 Context

There are some historical reasons for why it's being done this way:

  • The official Chromium team doesn't supply "stable" binaries of Chromium; they are usually compiled into stable versions by third-parties.
  • Chromium installation breaks when installed with snap packages on Ubuntu.
  • apt-get install -y chromium on Ubuntu 20.04+ is just a wrapper for a snap installations.
  • Referenced this guide to find a reliable PPA: How to Install Chromium Browser via PPA in Ubuntu 20.04, 20.10 - credit to UbuntuHandbook.

⚖️ Caveats

The maintainers may wish to scrutinize the default PPA used here, both for security and stability concerns. I agree!

I think future improvement to this feature could include:

  • Parameterizing the selected PPA to allow sourcing chromium binaries from public and private PPAs.

🧪 Test Results

I ran tests locally, prior to creating this pull request and recevied these results:

┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
|    Dev Container Features   |   
│           v0.66.0           │
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘

>  baseImage:         ubuntu:focal
>  Target Folder:     /workspaces/features
>  features:          chromium-apt-get

🏃 Starting test(s)...

🧪 Starting 'chromium-apt-get' tests...
🧪 Executing scenarios for feature 'chromium-apt-get'...
>  Running scenario:  test_ubuntu

📝 Scenario generated: {
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
  "features": {
    "./chromium-apt-get": {}
  }
}
>  workspaceFolder:   /tmp/devcontainercli/container-features-test/1722128470487

⏳ Building test container...

# -- Omitted docker build output --

🚀 Launched container.
>  containerId:          8ddfc23fefc54823744a59a1ef074d15ad8b68506c54690247f497b55f6df366

🔄 Testing 'chromium --version'

Chromium 126.0.6478.182 built on Ubuntu , running on Ubuntu 22.04

✅  Passed 'chromium --version'!

Test Passed!
>  Running scenario:  test_debian

📝 Scenario generated: {
  "image": "mcr.microsoft.com/devcontainers/base:debian",
  "features": {
    "./chromium-apt-get": {}
  }
}
>  workspaceFolder:   /tmp/devcontainercli/container-features-test/1722128474781

⏳ Building test container...

# -- Omitted docker build output --

🚀 Launched container.
>  containerId:          bc1843d135f8013e9dccde04cc5d9d6cb7a9d4f6292e11a8c614e1e9e968663b

🔄 Testing 'chromium --version'

Chromium 126.0.6478.182 built on Debian 12.6, running on Debian 12.6

✅  Passed 'chromium --version'!

Test Passed!
🧪 Executing duplicate test for feature 'chromium-apt-get'...
⚠️ Skipping duplicate test for chromium-apt-get because '/workspaces/features/test/chromium-apt-get/duplicate.sh' does not exist.
🧹 Cleaning up 2 test containers...
🧹 Removing container bc1843d135f8...
🧹 Removing container 8ddfc23fefc5...

  ================== TEST REPORT ==================
✅ Passed:      'test_ubuntu'
✅ Passed:      'test_debian'

Introduces tests for the new feature, as required for an eventual submission
Required for feature to be read by devcontainer CLI
Adds implementation details for the new feature

Installs chromium from `xtradeb/apps` PPA for use as headless browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant