clean up Dockerfile and move down config such that it does not trigger rebuild

This commit is contained in:
Ralf Vogler 2022-10-20 20:45:44 +02:00
parent 9f0e50afb6
commit a789034c51
2 changed files with 17 additions and 17 deletions

View file

@ -3,24 +3,11 @@ FROM ubuntu:focal
ARG DEBIAN_FRONTEND=noninteractive 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 # Playwright
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true
# === INSTALL Node.js === # === INSTALL Node.js ===
# Taken from https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal # Taken from https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.focal
RUN apt-get update && \ RUN apt-get update && \
# Install node16 # Install node16
@ -35,7 +22,6 @@ RUN apt-get update && \
# Create the pwuser # Create the pwuser
adduser pwuser adduser pwuser
# === Install the base requirements to run and debug webdriver implementations === # === Install the base requirements to run and debug webdriver implementations ===
RUN apt-get update \ RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \ && apt-get install --no-install-recommends --no-install-suggests -y \
@ -52,11 +38,13 @@ RUN apt-get update \
/usr/share/doc/* \ /usr/share/doc/* \
/var/cache/* \ /var/cache/* \
/var/lib/apt/lists/* \ /var/lib/apt/lists/* \
/var/tmp/* \ /var/tmp/*
&& ln -s $NOVNC_HOME/vnc_auto.html $NOVNC_HOME/index.html
RUN ln -s /usr/share/novnc/vnc_auto.html /usr/share/novnc/index.html
WORKDIR /fgc WORKDIR /fgc
COPY package*.json . COPY package*.json .
# Install chromium & dependencies only # Install chromium & dependencies only
RUN npm install \ RUN npm install \
&& npx playwright install --with-deps chromium \ && npx playwright install --with-deps chromium \
@ -66,9 +54,21 @@ RUN npm install \
COPY . . COPY . .
# Shell scripts # Shell scripts
# On windows, git might be configured to check out dos/CRLF line endings, so we convert.
RUN dos2unix ./docker/*.sh RUN dos2unix ./docker/*.sh
RUN mv ./docker/entrypoint.sh /usr/local/bin/entrypoint \ RUN mv ./docker/entrypoint.sh /usr/local/bin/entrypoint \
&& chmod +x /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"] ENTRYPOINT ["entrypoint"]
CMD ["node", "epic-games.js"] CMD ["node", "epic-games.js"]

View file

@ -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 & 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}" 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 DISPLAY=:1.0
export DISPLAY export DISPLAY
exec tini -g -- "$@" exec tini -g -- "$@"