@@ -10,13 +10,14 @@ if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
1010 echo " "
1111 echo " docker run --rm -it playwright:localbuild-noble /bin/bash"
1212 echo " "
13- echo " NOTE: this requires on Playwright PIP dependencies to be installed"
13+ echo " NOTE: this requires a JDK, Maven and npm on the host: the client is built here"
14+ echo " and the image only runs it to install the browsers."
1415 echo " "
1516 exit 0
1617fi
1718
1819function cleanup() {
19- :
20+ rm -rf dist
2021}
2122
2223trap " cleanup; cd $( pwd -P) " EXIT
3435
3536PW_TARGET_ARCH=$( echo $1 | cut -c3-)
3637
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
38+ # In the release pipeline ~/.m2/settings.xml routes all Maven downloads through the
39+ # DevDiv_PublicPackages feed instead of Maven Central, which the agent cannot reach .
40+ MVN=(mvn --no-transfer-progress)
4041
41- # The jammy and noble images install this Maven (see the Dockerfiles). Fetch it with the
42- # host's Maven so that it resolves through the configured mirror: the release pipeline
43- # cannot reach Maven Central directly (see .azure-pipelines/settings.xml).
44- MAVEN_VERSION=3.9.12
45- mvn dependency:copy -Dartifact= " org.apache.maven:apache-maven: ${MAVEN_VERSION} :tar.gz:bin " \
46- -DoutputDirectory=maven --no-transfer-progress -q
42+ # Like the other language ports, build the client on the host, where npm, a JDK and
43+ # Maven are available, and stage the client jar and its runtime dependencies under
44+ # dist/. The Dockerfile runs the CLI from there to install the browsers and their
45+ # dependencies. The build context is this directory, so nothing else reaches the image.
46+ ../../scripts/download_driver.sh
47+ " ${MVN[@]} " -B install -D skipTests -f ../../pom.xml
4748
48- SECRET_ARGS=()
49- if [[ -n " ${MAVEN_SETTINGS_SECRET:- } " ]]; then
50- SECRET_ARGS+=(--secret " id=mavensettings,src=${MAVEN_SETTINGS_SECRET} " )
49+ if ! PW_VERSION=$( " ${MVN[@]} " -q -N -f ../../pom.xml exec:exec -D exec.executable=echo \
50+ -D exec.args=' ${project.version}' ) ; then
51+ # With -q Maven prints its errors to stdout, which was captured above.
52+ echo " ERROR: failed to read the project version: ${PW_VERSION} "
53+ exit 1
5154fi
55+ rm -rf dist
56+ " ${MVN[@]} " -q -f ../../playwright/pom.xml dependency:copy-dependencies \
57+ -D includeScope=runtime -D outputDirectory=" $PWD /dist"
58+ cp " ../../playwright/target/playwright-$PW_VERSION .jar" dist/
59+
60+ # The jammy and noble images install this Maven (see the Dockerfiles).
61+ MAVEN_VERSION=3.9.12
62+ " ${MVN[@]} " -q dependency:copy -D artifact=" org.apache.maven:apache-maven:${MAVEN_VERSION} :tar.gz:bin" \
63+ -D outputDirectory=maven
5264
5365# Keep each arch image a plain single-platform manifest without the unknown/unknown platform entry.
5466export BUILDX_NO_DEFAULT_ATTESTATIONS=1
@@ -69,8 +81,7 @@ for ((attempt = 1; attempt <= MAX_ATTEMPTS; attempt++)); do
6981 --build-arg " MAVEN_VERSION=${MAVEN_VERSION} " \
7082 --build-arg ACR_CACHE_PREFIX=" ${ACR_CACHE_PREFIX} " \
7183 --build-arg UBUNTU_MIRROR_PREFIX=" ${UBUNTU_MIRROR_PREFIX} " \
72- " ${SECRET_ARGS[@]} " \
73- -t " $3 " -f " Dockerfile.$2 " ../../; then
84+ -t " $3 " -f " Dockerfile.$2 " . ; then
7485 exit 0
7586 fi
7687 if (( attempt < MAX_ATTEMPTS )) ; then
0 commit comments