Skip to content

Commit

Permalink
Merge pull request #18 from linuxserver/faster-playwright
Browse files Browse the repository at this point in the history
Optimise playwright build and hope MS don't break it
  • Loading branch information
thespad authored Mar 18, 2024
2 parents b9a8ead + 4429a57 commit ea183b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
19 changes: 1 addition & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN \
libc-dev \
libffi-dev \
libxslt-dev \
npm \
openssl-dev \
python3-dev \
zip \
Expand Down Expand Up @@ -53,23 +52,7 @@ RUN \
git clone --depth 1 --branch "${PLAYWRIGHT_PY_RELEASE}" https://github.com/microsoft/playwright-python /tmp/playwright-python && \
cd /tmp/playwright-python && \
pip install -U --no-cache-dir . && \
git clone --depth 1 --branch "${PLAYWRIGHT_PY_RELEASE}" https://github.com/microsoft/playwright /tmp/playwright && \
cd /tmp/playwright && \
npm ci && \
npm run build && \
# Don't build for other platforms
sed -i '/-darwin-x64/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/-darwin-arm64/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/-linux-arm64/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/-win-x64/d' ./utils/build/build-playwright-driver.sh && \
# Don't download a static node binary, use the OS install
sed -i '/curl ${NODE_URL}/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/elif \[\[ "${ARCHIVE}" == "tar.gz" \]\]; then/,/else/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/cp .\/output\/${NODE_DIR}\/LICENSE .\/output\/playwright-${SUFFIX}\//d' ./utils/build/build-playwright-driver.sh && \
sed -i 's/"..\/..\/${NODE_DIR}\/${NPM_PATH}"/\/usr\/lib\/node_modules\/npm\/bin\/npm-cli.js/' ./utils/build/build-playwright-driver.sh && \
./utils/build/build-playwright-driver.sh && \
rm -rf /lsiopy/lib/python3.11/site-packages/playwright/driver/* && \
cp -R ./utils/build/output/playwright-linux/* /lsiopy/lib/python3.11/site-packages/playwright/driver && \
rm -f /lsiopy/lib/python3.11/site-packages/playwright/driver/node && \
ln -s /usr/bin/node /lsiopy/lib/python3.11/site-packages/playwright/driver/node && \
apk del --purge \
build-dependencies && \
Expand Down
19 changes: 1 addition & 18 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN \
libc-dev \
libffi-dev \
libxslt-dev \
npm \
openssl-dev \
python3-dev \
zip \
Expand Down Expand Up @@ -54,23 +53,7 @@ RUN \
git clone --depth 1 --branch "${PLAYWRIGHT_PY_RELEASE}" https://github.com/microsoft/playwright-python /tmp/playwright-python && \
cd /tmp/playwright-python && \
pip install -U --no-cache-dir . && \
git clone --depth 1 --branch "${PLAYWRIGHT_PY_RELEASE}" https://github.com/microsoft/playwright /tmp/playwright && \
cd /tmp/playwright && \
npm ci && \
npm run build && \
# Don't build for other platforms
sed -i '/-darwin-x64/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/-darwin-arm64/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/-linux-x64/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/-win-x64/d' ./utils/build/build-playwright-driver.sh && \
# Don't download a static node binary, use the OS install
sed -i '/curl ${NODE_URL}/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/elif \[\[ "${ARCHIVE}" == "tar.gz" \]\]; then/,/else/d' ./utils/build/build-playwright-driver.sh && \
sed -i '/cp .\/output\/${NODE_DIR}\/LICENSE .\/output\/playwright-${SUFFIX}\//d' ./utils/build/build-playwright-driver.sh && \
sed -i 's/"..\/..\/${NODE_DIR}\/${NPM_PATH}"/\/usr\/lib\/node_modules\/npm\/bin\/npm-cli.js/' ./utils/build/build-playwright-driver.sh && \
./utils/build/build-playwright-driver.sh && \
rm -rf /lsiopy/lib/python3.11/site-packages/playwright/driver/* && \
cp -R ./utils/build/output/playwright-linux-arm64/* /lsiopy/lib/python3.11/site-packages/playwright/driver && \
rm -f /lsiopy/lib/python3.11/site-packages/playwright/driver/node && \
ln -s /usr/bin/node /lsiopy/lib/python3.11/site-packages/playwright/driver/node && \
apk del --purge \
build-dependencies && \
Expand Down

0 comments on commit ea183b4

Please sign in to comment.