diff --git a/node-playwright-chrome/Dockerfile b/node-playwright-chrome/Dockerfile index 3caad92..6304cb5 100644 --- a/node-playwright-chrome/Dockerfile +++ b/node-playwright-chrome/Dockerfile @@ -13,7 +13,7 @@ RUN \ # Disable chrome auto updates, based on https://support.google.com/chrome/a/answer/9052345 mkdir -p /etc/default && echo 'repo_add_once=false' > /etc/default/google-chrome \ && apt-get update \ - && apt-get install -y wget gnupg unzip ca-certificates xvfb --no-install-recommends \ + && apt-get install -y wget gnupg unzip ca-certificates xvfb xauth --no-install-recommends \ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ && sh -c 'echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list' \ @@ -59,7 +59,7 @@ WORKDIR /home/myuser ENV PLAYWRIGHT_BROWSERS_PATH=/home/myuser/pw-browsers # Copy source code and xvfb script -COPY --chown=myuser:myuser package.json main.js chrome_test.js start_xvfb_and_run_cmd.sh /home/myuser/ +COPY --chown=myuser:myuser package.json main.js chrome_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh /home/myuser/ # Sets path to Chrome executable, this is used by Apify.launchPuppeteer() ENV APIFY_CHROME_EXECUTABLE_PATH=/usr/bin/google-chrome @@ -110,4 +110,5 @@ ENV XVFB_WHD=1920x1080x24+32 # NOTEs: # - This needs to be compatible with CLI. # - Using CMD instead of ENTRYPOINT, to allow manual overriding -CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +# CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +CMD ./new_xvfb_run_cmd.sh npm start --silent diff --git a/node-playwright-chrome/new_xvfb_run_cmd.sh b/node-playwright-chrome/new_xvfb_run_cmd.sh new file mode 100755 index 0000000..141f76f --- /dev/null +++ b/node-playwright-chrome/new_xvfb_run_cmd.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" npm start --silent + +echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" +xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" diff --git a/node-playwright-firefox/Dockerfile b/node-playwright-firefox/Dockerfile index 49f0acf..821c640 100644 --- a/node-playwright-firefox/Dockerfile +++ b/node-playwright-firefox/Dockerfile @@ -18,6 +18,7 @@ RUN sh -c 'echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> jq \ wget \ p11-kit \ + xauth \ \ # Register cerificates && chmod +x ./register_intermediate_certs.sh \ @@ -52,7 +53,7 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/home/myuser/pw-browsers ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 # Copy source code and xvfb script -COPY --chown=myuser:myuser package.json main.js firefox_test.js start_xvfb_and_run_cmd.sh /home/myuser/ +COPY --chown=myuser:myuser package.json main.js firefox_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh /home/myuser/ # Tell Node.js this is a production environemnt ENV NODE_ENV=production @@ -97,4 +98,5 @@ ENV XVFB_WHD=1920x1080x24+32 # NOTEs: # - This needs to be compatible with CLI. # - Using CMD instead of ENTRYPOINT, to allow manual overriding -CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +# CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +CMD ./new_xvfb_run_cmd.sh npm start --silent diff --git a/node-playwright-firefox/new_xvfb_run_cmd.sh b/node-playwright-firefox/new_xvfb_run_cmd.sh new file mode 100755 index 0000000..141f76f --- /dev/null +++ b/node-playwright-firefox/new_xvfb_run_cmd.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" npm start --silent + +echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" +xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" diff --git a/node-playwright-webkit/Dockerfile b/node-playwright-webkit/Dockerfile index dfcd31c..a3e22bf 100644 --- a/node-playwright-webkit/Dockerfile +++ b/node-playwright-webkit/Dockerfile @@ -10,6 +10,7 @@ RUN apt-get update \ git \ procps \ xvfb \ + xauth \ # Install node && apt-get update && apt-get install -y curl \ && curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ @@ -48,7 +49,7 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/home/myuser/pw-browsers ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 # Copy source code and xvfb script -COPY --chown=myuser:myuser package.json main.js webkit_test.js start_xvfb_and_run_cmd.sh /home/myuser/ +COPY --chown=myuser:myuser package.json main.js webkit_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh /home/myuser/ # Tell Node.js this is a production environemnt ENV NODE_ENV=production @@ -87,4 +88,5 @@ ENV XVFB_WHD=1920x1080x24+32 # NOTEs: # - This needs to be compatible with CLI. # - Using CMD instead of ENTRYPOINT, to allow manual overriding -CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +# CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +CMD ./new_xvfb_run_cmd.sh npm start --silent diff --git a/node-playwright-webkit/new_xvfb_run_cmd.sh b/node-playwright-webkit/new_xvfb_run_cmd.sh new file mode 100755 index 0000000..141f76f --- /dev/null +++ b/node-playwright-webkit/new_xvfb_run_cmd.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" npm start --silent + +echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" +xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" diff --git a/node-playwright/Dockerfile b/node-playwright/Dockerfile index 51d277d..e876111 100644 --- a/node-playwright/Dockerfile +++ b/node-playwright/Dockerfile @@ -11,7 +11,7 @@ COPY ./register_intermediate_certs.sh ./register_intermediate_certs.sh # Install libs RUN apt-get update \ - && apt-get install --fix-missing -yq --no-install-recommends procps xvfb wget \ + && apt-get install --fix-missing -yq --no-install-recommends procps xvfb xauth wget \ && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix \ # Uninstall system NodeJs && apt-get purge -yq nodejs \ @@ -65,7 +65,7 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright ENV CRAWLEE_SKIP_BROWSER_INSTALL=1 # Copy source code and xvfb script -COPY --chown=myuser:myuser package.json main.js chrome_test.js start_xvfb_and_run_cmd.sh /home/myuser/ +COPY --chown=myuser:myuser package.json main.js chrome_test.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh /home/myuser/ # Sets path to Chrome executable, this is used by Apify.launchPuppeteer() ENV APIFY_CHROME_EXECUTABLE_PATH=/usr/bin/google-chrome @@ -105,4 +105,5 @@ ENV XVFB_WHD=1920x1080x24+32 # NOTEs: # - This needs to be compatible with CLI. # - Using CMD instead of ENTRYPOINT, to allow manual overriding -CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +# CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +CMD ./new_xvfb_run_cmd.sh npm start --silent diff --git a/node-playwright/new_xvfb_run_cmd.sh b/node-playwright/new_xvfb_run_cmd.sh new file mode 100755 index 0000000..141f76f --- /dev/null +++ b/node-playwright/new_xvfb_run_cmd.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" npm start --silent + +echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" +xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@" diff --git a/node-puppeteer-chrome/Dockerfile b/node-puppeteer-chrome/Dockerfile index 1d106da..bb7d015 100644 --- a/node-puppeteer-chrome/Dockerfile +++ b/node-puppeteer-chrome/Dockerfile @@ -29,6 +29,7 @@ RUN apt-get update \ procps \ xdg-utils \ xvfb \ + xauth \ --no-install-recommends \ # Disable chrome auto updates, based on https://support.google.com/chrome/a/answer/9052345 && mkdir -p /etc/default && echo 'repo_add_once=false' > /etc/default/google-chrome \ @@ -61,7 +62,7 @@ USER myuser WORKDIR /home/myuser # Copy source code and xvfb script -COPY --chown=myuser:myuser package.json main.js puppeteer_*.js start_xvfb_and_run_cmd.sh /home/myuser/ +COPY --chown=myuser:myuser package.json main.js puppeteer_*.js start_xvfb_and_run_cmd.sh new_xvfb_run_cmd.sh /home/myuser/ # Uncomment to skip the chromium download when installing puppeteer. If you do, # you'll need to launch puppeteer with: @@ -102,4 +103,5 @@ ENV XVFB_WHD=1920x1080x24+32 # NOTEs: # - This needs to be compatible with CLI. # - Using CMD instead of ENTRYPOINT, to allow manual overriding -CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +# CMD ./start_xvfb_and_run_cmd.sh && npm start --silent +CMD ./new_xvfb_run_cmd.sh npm start --silent diff --git a/node-puppeteer-chrome/new_xvfb_run_cmd.sh b/node-puppeteer-chrome/new_xvfb_run_cmd.sh new file mode 100755 index 0000000..141f76f --- /dev/null +++ b/node-puppeteer-chrome/new_xvfb_run_cmd.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" npm start --silent + +echo "Will run command: xvfb-run -a -s \"-ac -screen 0 $XVFB_WHD -nolisten tcp\" $@" +xvfb-run -a -s "-ac -screen 0 $XVFB_WHD -nolisten tcp" "$@"