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

Build and publish browser-enabled Docker image #3199

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

andrewslotin
Copy link
Contributor

What?

This PR adds a stage to the Dockerfile that adds chromium to the Docker image and enables k6 Browser API. The new stage is used to build and publish images with -with-browser label suffix.

The resulting image is fairly large (~220MB compressed compared to ~16MB without chromium installed), hence a separate label for those who want to opt-in to use Browser API.

Why?

Currently there is no easy way to use Browser API when running k6 as a Docker container. This makes it difficult to run browser-based tests in CI, since users need to first launch browser process in a separate container, provide the CDP URL to the k6 container and conditionally use browser.connect() instead of browser.launch() in their test scripts.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have tested the build pipeline changes in andrewslotin/k6 fork (see the Docker Hub image)

Related PR(s)/Issue(s)

Closes #2914

@codecov-commenter
Copy link

codecov-commenter commented Jul 14, 2023

Codecov Report

Merging #3199 (556f70d) into master (344c446) will not change coverage.
The diff coverage is n/a.

❗ Current head 556f70d differs from pull request most recent head a5fb29c. Consider uploading reports for the commit a5fb29c to get more accurate results

@@           Coverage Diff           @@
##           master    #3199   +/-   ##
=======================================
  Coverage   73.23%   73.23%           
=======================================
  Files         259      259           
  Lines       19889    19889           
=======================================
  Hits        14565    14565           
+ Misses       4402     4401    -1     
- Partials      922      923    +1     
Flag Coverage Δ
ubuntu 73.16% <ø> (ø)
windows 73.07% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 2 files with indirect coverage changes

Dockerfile Outdated Show resolved Hide resolved
Copy link
Contributor

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I just have that one question around the flags and running in headless, but otherwise it looks good.

Dockerfile Outdated Show resolved Hide resolved
Copy link
Contributor

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@ka3de ka3de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@mstoykov mstoykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Are you going to squash this PR if not I would recommend force pushing to fix the fixups

@andrewslotin
Copy link
Contributor Author

@mstoykov, my plan is to rebase and squash the fixup commits before merging.

@andrewslotin andrewslotin merged commit 8a04dc0 into master Jul 25, 2023
20 checks passed
@andrewslotin andrewslotin deleted the browser_enabled_image branch July 25, 2023 09:01
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.

Publish Docker image that includes a browser
5 participants