mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
devops: demand explicit arch when building docker (#10743)
Currently, arch is inhereted from host. This patch explicitly sets desired docker build arch. References #10351
This commit is contained in:
parent
fe00c1f5d3
commit
e680b733f5
@ -3,7 +3,7 @@ set -e
|
|||||||
set +x
|
set +x
|
||||||
|
|
||||||
if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
|
if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
|
||||||
echo "usage: $(basename $0) {bionic,focal} playwright:localbuild-focal"
|
echo "usage: $(basename $0) {--arm64,--amd64} {bionic,focal} playwright:localbuild-focal"
|
||||||
echo
|
echo
|
||||||
echo "Build Playwright docker image and tag it as 'playwright:localbuild-focal'."
|
echo "Build Playwright docker image and tag it as 'playwright:localbuild-focal'."
|
||||||
echo "Once image is built, you can run it with"
|
echo "Once image is built, you can run it with"
|
||||||
@ -17,7 +17,7 @@ if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
rm -f "playwright.tar.gz"
|
rm -f "playwright-core.tar.gz"
|
||||||
}
|
}
|
||||||
|
|
||||||
trap "cleanup; cd $(pwd -P)" EXIT
|
trap "cleanup; cd $(pwd -P)" EXIT
|
||||||
@ -27,4 +27,14 @@ cd "$(dirname "$0")"
|
|||||||
# image.
|
# image.
|
||||||
node ../../utils/pack_package.js playwright-core ./playwright-core.tar.gz
|
node ../../utils/pack_package.js playwright-core ./playwright-core.tar.gz
|
||||||
|
|
||||||
docker build -t "$2" -f "Dockerfile.$1" .
|
PLATFORM=""
|
||||||
|
if [[ "$1" == "--arm64" ]]; then
|
||||||
|
PLATFORM="linux/arm64";
|
||||||
|
elif [[ "$1" == "--amd64" ]]; then
|
||||||
|
PLATFORM="linux/amd64"
|
||||||
|
else
|
||||||
|
echo "ERROR: unknown platform specifier - $1. Only --arm64 or --amd64 is supported"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build --platform "${PLATFORM}" -t "$3" -f "Dockerfile.$2" .
|
||||||
|
Loading…
Reference in New Issue
Block a user