-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devops: bake browsers into Docker image (#2990)
This patch bakes browsers into docker image. Important observations: - We now re-build docker image everytime we roll browsers. - Docker image size almost doubles: from `225MB` to `496MB`. References #2926
- Loading branch information
1 parent
9a2245d
commit 7d2078e
Showing
7 changed files
with
122 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
(generated with docker-image-size.sh) | ||
225M | ||
496M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
set -e | ||
set +x | ||
|
||
if [[ ($1 == '--help') || ($1 == '-h') ]]; then | ||
echo "usage: $(basename $0) [--prepare-only]" | ||
echo | ||
echo "Build Playwright docker image and tag it as 'playwright:localbuild'." | ||
echo "Once image is built, you can run it with" | ||
echo "" | ||
echo " docker run --rm -it playwright:localbuild /bin/bash" | ||
echo "" | ||
echo "NOTE: this requires on Playwright dependencies to be installed with 'npm install'" | ||
echo " and Playwright itself being built with 'npm run build'" | ||
echo | ||
echo " --prepare-context prepare docker context and skip building." | ||
echo " This is to defer building & publishing to Docker Github Action." | ||
echo "" | ||
exit 0 | ||
fi | ||
|
||
PREPARE_CONTEXT_ONLY="" | ||
if [[ $1 == "--prepare-context" ]]; then | ||
PREPARE_CONTEXT_ONLY="1" | ||
fi | ||
|
||
function cleanup() { | ||
if [[ -z "${PREPARE_CONTEXT_ONLY}" ]]; then | ||
rm -f "playwright.tar.gz" | ||
fi | ||
} | ||
|
||
trap "cleanup; cd $(pwd -P)" EXIT | ||
cd "$(dirname "$0")" | ||
|
||
# We rely on `./playwright.tar.gz` to download browsers into the docker | ||
# image. | ||
node ../../packages/build_package.js playwright ./playwright.tar.gz | ||
|
||
if [[ -n "${PREPARE_CONTEXT_ONLY}" ]]; then | ||
exit 0 | ||
fi | ||
|
||
docker build -t "playwright:localbuild" -f Dockerfile.bionic . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters