File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,22 +37,16 @@ download() {
3737DRIVER_VERSION=$( head -1 ./DRIVER_VERSION)
3838
3939# Resolve the exact upstream commit that produced this driver version, so that the
40- # bundled Node.js version matches the driver exactly. Query the npm registry over
41- # HTTP instead of the npm CLI which is not available in the docker image build.
42- VERSION_MANIFEST=$( mktemp)
43- download " https://registry.npmjs.org/playwright/$DRIVER_VERSION " " $VERSION_MANIFEST "
44- GIT_HEAD=$( grep -o ' "gitHead"[[:space:]]*:[[:space:]]*"[0-9a-f]\{40\}"' " $VERSION_MANIFEST " | head -1 | grep -o ' [0-9a-f]\{40\}' )
45- rm -f " $VERSION_MANIFEST "
40+ # bundled Node.js version matches the driver exactly.
41+ GIT_HEAD=$( npm view playwright@" $DRIVER_VERSION " gitHead)
4642if [[ -z " $GIT_HEAD " ]]; then
4743 echo " Failed to resolve upstream commit (gitHead) for playwright@$DRIVER_VERSION "
4844 exit 1
4945fi
5046
5147# The Node.js version is kept in sync with the driver version in the upstream build script.
52- BUILD_SCRIPT=$( mktemp)
53- download " https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD /utils/build/build-playwright-driver.sh" " $BUILD_SCRIPT "
54- NODE_VERSION=$( sed -n ' s/^NODE_VERSION="\([^"]*\)".*/\1/p' " $BUILD_SCRIPT " )
55- rm -f " $BUILD_SCRIPT "
48+ NODE_VERSION=$( curl -fsSL " https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD /utils/build/build-playwright-driver.sh" \
49+ | sed -n ' s/^NODE_VERSION="\([^"]*\)".*/\1/p' )
5650if [[ -z " $NODE_VERSION " ]]; then
5751 echo " Failed to determine Node.js version for playwright@$DRIVER_VERSION ($GIT_HEAD )"
5852 exit 1
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ RUN mkdir /ms-playwright && \
4444COPY . /tmp/pw-java
4545
4646RUN cd /tmp/pw-java && \
47- ./scripts/download_driver.sh && \
4847 mvn install -D skipTests --no-transfer-progress && \
4948 DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
5049 -D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ RUN mkdir /ms-playwright && \
4444COPY . /tmp/pw-java
4545
4646RUN cd /tmp/pw-java && \
47- ./scripts/download_driver.sh && \
4847 mvn install -D skipTests --no-transfer-progress && \
4948 DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
5049 -D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
Original file line number Diff line number Diff line change 3434
3535PW_TARGET_ARCH=$( echo $1 | cut -c3-)
3636
37+ # Assemble the driver on the host where npm is available; the Dockerfile picks
38+ # it up via `COPY . /tmp/pw-java`.
39+ ../../scripts/download_driver.sh
40+
3741docker build --platform " ${PLATFORM} " --build-arg " PW_TARGET_ARCH=${PW_TARGET_ARCH} " -t " $3 " -f " Dockerfile.$2 " ../../
You can’t perform that action at this time.
0 commit comments