Merge branch 'dev' into docker-ubuntu24

This commit is contained in:
Ralf Vogler 2025-06-05 23:06:50 +02:00
commit 14f9311a64
36 changed files with 2068 additions and 1338 deletions

View file

@ -2,64 +2,66 @@
FROM ubuntu:noble
# Configuration variables are at the end!
ARG DEBIAN_FRONTEND=noninteractive
# https://github.com/hadolint/hadolint/wiki/DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG DEBIAN_FRONTEND=noninteractive
# Install up-to-date node & npm, deps for virtual screen & noVNC, firefox, pipx for apprise.
# Install nodejs and deps for virtual display, noVNC, chromium, and pipx for installing apprise.
RUN apt-get update \
&& apt-get install -y curl wget gpg ca-certificates \
&& apt-get install -y --no-install-recommends curl ca-certificates gnupg \
&& mkdir -p /etc/apt/keyrings \
&& curl -sL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >> /etc/apt/sources.list.d/nodesource.list \
# Node.js
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
# TurboVNC & VirtualGL instead of Xvfb+X11vnc
&& curl --proto "=https" --tlsv1.2 -fsSL https://packagecloud.io/dcommander/virtualgl/gpgkey | gpg --dearmor -o /etc/apt/trusted.gpg.d/VirtualGL.gpg \
&& curl --proto "=https" --tlsv1.2 -fsSL https://packagecloud.io/dcommander/turbovnc/gpgkey | gpg --dearmor -o /etc/apt/trusted.gpg.d/TurboVNC.gpg \
&& curl --proto "=https" --tlsv1.2 -fsSL https://raw.githubusercontent.com/VirtualGL/repo/main/VirtualGL.list > /etc/apt/sources.list.d/VirtualGL.list \
&& curl --proto "=https" --tlsv1.2 -fsSL https://raw.githubusercontent.com/TurboVNC/repo/main/TurboVNC.list > /etc/apt/sources.list.d/TurboVNC.list \
# update lists and install
&& apt-get update \
&& apt-get install --no-install-recommends -y \
nodejs \
xvfb \
x11vnc \
tini \
virtualgl turbovnc ratpoison \
novnc websockify \
tini \
nodejs \
dos2unix \
pipx \
# && npx playwright install-deps firefox \
# When running playwright without deps, it said to install the below (which should be what install-deps above does)
&& apt-get install --no-install-recommends -y \
# RUN npx patchright install-deps chromium
# ^ installing deps manually instead saved ~130MB:
&& apt-get install -y --no-install-recommends \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libxkbcommon0 \
libatspi2.0-0 \
libxcomposite1 \
libxcursor1 \
libgtk-3-0t64 \
libpangocairo-1.0-0 \
libgbm1 \
libpango-1.0-0 \
libatk1.0-0t64 \
libcairo-gobject2 \
libcairo2 \
libgdk-pixbuf-2.0-0 \
libasound2t64 \
# needed for TurboVNC if not installing xfce4:
libxdamage1 \
&& apt-get autoremove -y \
# https://www.perplexity.ai/search/what-files-do-i-need-to-remove-imjwdphNSUWK98WzsmQswA
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/var/cache/* \
/var/tmp/* \
/tmp/* \
/usr/share/doc/* \
/var/cache/* \
/var/lib/apt/lists/* \
/var/tmp/*
#
# RUN node --version
# RUN npm --version
# TODO This was vnc_auto.html before which no longer exists, but only vnc_lite.html and vnc.html which we link now:
RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
RUN pipx install apprise
&& ln -s /usr/share/novnc/vnc_auto.html /usr/share/novnc/index.html \
&& pipx install apprise
WORKDIR /fgc
COPY package*.json ./
# Playwright installs patched firefox to ~/.cache/ms-playwright/firefox-*
# Requires some system deps to run (see inlined install-deps above).
RUN npm install
# Old: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD + install firefox (had to be done after `npm install` to get the correct version). Now: playwright-firefox as npm dep and `npm install` will only install that.
# From 1.38 Playwright will no longer install browser automatically for playwright, but apparently still for playwright-firefox: https://github.com/microsoft/playwright/releases/tag/v1.38.0
# RUN npx playwright install firefox
# --no-shell to avoid installing chromium_headless_shell (307MB) since headless mode could be detected without patching the browser itself
RUN npm install && npx patchright install chromium --no-shell && du -h -d1 ~/.cache/ms-playwright
COPY . .
@ -67,36 +69,36 @@ COPY . .
RUN dos2unix ./*.sh && chmod +x ./*.sh
COPY docker-entrypoint.sh /usr/local/bin/
# set by .github/workflows/docker.yml
ARG COMMIT=""
ARG BRANCH=""
ARG NOW=""
# need as env vars to log in docker-entrypoint.sh
ENV COMMIT=${COMMIT}
ENV BRANCH=${BRANCH}
ENV NOW=${NOW}
LABEL org.opencontainers.image.title="free-games-claimer" \
org.opencontainers.image.name="free-games-claimer" \
org.opencontainers.image.description="Automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG" \
org.opencontainers.image.url="https://github.com/vogler/free-games-claimer" \
org.opencontainers.image.source="https://github.com/vogler/free-games-claimer" \
org.opencontainers.image.revision=${COMMIT} \
org.opencontainers.image.ref.name=${BRANCH} \
org.opencontainers.image.base.name="ubuntu:jammy" \
org.opencontainers.image.version="latest"
# added by docker/metadata-action using data from GitHub
# LABEL org.opencontainers.image.title="free-games-claimer" \
# org.opencontainers.image.url="https://github.com/vogler/free-games-claimer" \
# org.opencontainers.image.source="https://github.com/vogler/free-games-claimer"
# Configure VNC via environment variables:
ENV VNC_PORT 5900
ENV NOVNC_PORT 6080
ENV VNC_PORT=5900
ENV NOVNC_PORT=6080
EXPOSE 5900
EXPOSE 6080
# Configure Xvfb via environment variables:
ENV WIDTH 1920
ENV HEIGHT 1080
ENV DEPTH 24
ENV WIDTH=1920
ENV HEIGHT=1080
ENV DEPTH=24
# Show browser instead of running headless
ENV SHOW 1
ENV SHOW=1
# mega-linter (KICS, Trivy) complained about it missing - usually this checks some API endpoint, for a container that runs ~1min a healthcheck doesn't make that much sense since playwright has timeouts for everything. Could react to SIGUSR1 and check something in JS - for now we just check that node is running and noVNC is reachable...
HEALTHCHECK --interval=5s --timeout=5s CMD pgrep node && curl --fail http://localhost:6080 || exit 1
# Script to setup display server & VNC is always executed.
ENTRYPOINT ["docker-entrypoint.sh"]