From a789034c513801d012d686fa1ca49eef492b0ce6 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 20 Oct 2022 20:45:44 +0200 Subject: [PATCH] clean up Dockerfile and move down config such that it does not trigger rebuild --- Dockerfile | 32 ++++++++++++++++---------------- docker/entrypoint.sh | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ebba26..5fd0b7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,24 +3,11 @@ FROM ubuntu:focal ARG DEBIAN_FRONTEND=noninteractive -# Configure Xvfb via environment variables: -ENV SCREEN_WIDTH 1440 -ENV SCREEN_HEIGHT 900 -ENV SCREEN_DEPTH 24 - -# Configure VNC via environment variables: -ENV VNC_PORT 5900 -ENV NOVNC_PORT 6080 -ENV NOVNC_HOME /usr/share/novnc -EXPOSE 5900 -EXPOSE 6080 - # Playwright ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true # === INSTALL Node.js === - # Taken from https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal RUN apt-get update && \ # Install node16 @@ -35,7 +22,6 @@ RUN apt-get update && \ # Create the pwuser adduser pwuser - # === Install the base requirements to run and debug webdriver implementations === RUN apt-get update \ && apt-get install --no-install-recommends --no-install-suggests -y \ @@ -52,11 +38,13 @@ RUN apt-get update \ /usr/share/doc/* \ /var/cache/* \ /var/lib/apt/lists/* \ - /var/tmp/* \ - && ln -s $NOVNC_HOME/vnc_auto.html $NOVNC_HOME/index.html + /var/tmp/* + +RUN ln -s /usr/share/novnc/vnc_auto.html /usr/share/novnc/index.html WORKDIR /fgc COPY package*.json . + # Install chromium & dependencies only RUN npm install \ && npx playwright install --with-deps chromium \ @@ -66,9 +54,21 @@ RUN npm install \ COPY . . # Shell scripts +# On windows, git might be configured to check out dos/CRLF line endings, so we convert. RUN dos2unix ./docker/*.sh RUN mv ./docker/entrypoint.sh /usr/local/bin/entrypoint \ && chmod +x /usr/local/bin/entrypoint +# Configure VNC via environment variables: +ENV VNC_PORT 5900 +ENV NOVNC_PORT 6080 +EXPOSE 5900 +EXPOSE 6080 + +# Configure Xvfb via environment variables: +ENV SCREEN_WIDTH 1440 +ENV SCREEN_HEIGHT 900 +ENV SCREEN_DEPTH 24 + ENTRYPOINT ["entrypoint"] CMD ["node", "epic-games.js"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 13d8837..5508a96 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -20,7 +20,7 @@ rm -f /tmp/.X1-lock Xvfb :1 -ac -screen 0 "${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH}" >/dev/null 2>&1 & x11vnc -display :1.0 -forever -shared -rfbport "${VNC_PORT:-5900}" -bg -nopw # -passwd "${VNC_PASSWORD}" -websockify -D --web "$NOVNC_HOME" "$NOVNC_PORT" "localhost:$VNC_PORT" & +websockify -D --web "/usr/share/novnc/" "$NOVNC_PORT" "localhost:$VNC_PORT" & DISPLAY=:1.0 export DISPLAY exec tini -g -- "$@"