wip: docker alpine version
This commit is contained in:
parent
7971be297c
commit
5e6df5b82d
5 changed files with 108 additions and 3 deletions
70
Dockerfile.alpine
Normal file
70
Dockerfile.alpine
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
FROM node:16-alpine
|
||||||
|
|
||||||
|
# Configure Xvfb via environment variables:
|
||||||
|
ENV SCREEN_WIDTH 1440
|
||||||
|
ENV SCREEN_HEIGHT 900
|
||||||
|
ENV SCREEN_DEPTH 24
|
||||||
|
ENV DISPLAY :60
|
||||||
|
|
||||||
|
# Configure VNC via environment variables:
|
||||||
|
ENV VNC_ENABLED true
|
||||||
|
ENV VNC_PASSWORD secret
|
||||||
|
ENV VNC_PORT 5900
|
||||||
|
ENV NOVNC_PORT 6080
|
||||||
|
EXPOSE 5900
|
||||||
|
EXPOSE 6080
|
||||||
|
|
||||||
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||||
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true
|
||||||
|
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||||
|
|
||||||
|
# Installs latest Chromium package.
|
||||||
|
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories \
|
||||||
|
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
|
||||||
|
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
|
||||||
|
&& echo "http://dl-cdn.alpinelinux.org/alpine/v3.12/main" >> /etc/apk/repositories \
|
||||||
|
&& apk upgrade -U -a \
|
||||||
|
&& apk add --no-cache \
|
||||||
|
libstdc++ \
|
||||||
|
chromium \
|
||||||
|
harfbuzz \
|
||||||
|
nss \
|
||||||
|
freetype \
|
||||||
|
ttf-freefont \
|
||||||
|
font-noto-emoji \
|
||||||
|
wqy-zenhei
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
tini \
|
||||||
|
xvfb \
|
||||||
|
x11vnc \
|
||||||
|
novnc
|
||||||
|
|
||||||
|
COPY ./docker/local.conf /etc/fonts/local.conf
|
||||||
|
|
||||||
|
# Shell scripts
|
||||||
|
ENV NOVNC_HOME /usr/share/novnc
|
||||||
|
COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint
|
||||||
|
COPY ./docker/vnc-start.sh /usr/local/bin/vnc-start
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint \
|
||||||
|
&& chmod +x /usr/local/bin/vnc-start \
|
||||||
|
&& ln -s "$NOVNC_HOME/vnc.html" "$NOVNC_HOME/index.html"
|
||||||
|
|
||||||
|
# Add Chrome as a user
|
||||||
|
RUN mkdir -p /fgc \
|
||||||
|
&& adduser -D chrome \
|
||||||
|
&& chown -R chrome:chrome /fgc
|
||||||
|
# Run app as non-privileged
|
||||||
|
USER chrome
|
||||||
|
WORKDIR /fgc
|
||||||
|
|
||||||
|
# Install Playwright
|
||||||
|
COPY --chown=chrome package.json package-lock.json ./
|
||||||
|
RUN npm install
|
||||||
|
RUN npx playwright install chromium
|
||||||
|
COPY --chown=chrome . ./
|
||||||
|
|
||||||
|
ENV CHROME_BIN=/usr/bin/chromium-browser \
|
||||||
|
CHROME_PATH=/usr/lib/chromium/
|
||||||
|
|
||||||
|
ENTRYPOINT [ "entrypoint" ]
|
||||||
|
CMD ["node", "epic-games.js"]
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
Xvfb "$DISPLAY" -ac -screen 0 "${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH}" >/dev/null 2>&1 &
|
Xvfb "$DISPLAY" -ac -screen 0 "${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH}" >/dev/null 2>&1 &
|
||||||
|
|
||||||
if [ "$VNC_ENABLED" = true ]; then
|
if [ "$VNC_ENABLED" = true ]; then
|
||||||
|
echo "Starting VNC server..."
|
||||||
|
# wait for Xvfb to start up
|
||||||
|
sleep 3
|
||||||
vnc-start >/dev/null 2>&1 &
|
vnc-start >/dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
31
docker/local.conf
Normal file
31
docker/local.conf
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||||
|
<fontconfig>
|
||||||
|
|
||||||
|
<alias>
|
||||||
|
<family>sans-serif</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Main sans-serif font name goes here</family>
|
||||||
|
<family>Noto Color Emoji</family>
|
||||||
|
<family>Noto Emoji</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
|
||||||
|
<alias>
|
||||||
|
<family>serif</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Main serif font name goes here</family>
|
||||||
|
<family>Noto Color Emoji</family>
|
||||||
|
<family>Noto Emoji</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
|
||||||
|
<alias>
|
||||||
|
<family>monospace</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Main monospace font name goes here</family>
|
||||||
|
<family>Noto Color Emoji</family>
|
||||||
|
<family>Noto Emoji</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
</fontconfig>
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
# Start VNC in a background process:
|
# Start VNC in a background process:
|
||||||
x11vnc -display "$DISPLAY" -forever -shared -rfbport "${VNC_PORT:-5900}" \
|
x11vnc -display "$DISPLAY" -forever -shared -rfbport "${VNC_PORT:-5900}" \
|
||||||
-passwd "${VNC_PASSWORD:-secret}" -bg
|
-passwd "${VNC_PASSWORD:-secret}" -bg
|
||||||
NOVNC_HOME=/usr/share/novnc
|
NOVNC_HOME=/usr/share/novnc
|
||||||
ln -s $NOVNC_HOME/vnc_auto.html $NOVNC_HOME/index.html
|
# ln -s $NOVNC_HOME/vnc_auto.html $NOVNC_HOME/index.html
|
||||||
websockify -D --web "$NOVNC_HOME" "$NOVNC_PORT" "localhost:$VNC_PORT" &
|
websockify -D --web "$NOVNC_HOME" "$NOVNC_PORT" "localhost:$VNC_PORT" &
|
||||||
|
|
||||||
# Execute the given command:
|
# Execute the given command:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const debug = process.env.PWDEBUG == '1'; // runs non-headless and opens https:/
|
||||||
const URL_CLAIM = 'https://store.epicgames.com/en-US/free-games';
|
const URL_CLAIM = 'https://store.epicgames.com/en-US/free-games';
|
||||||
const URL_LOGIN = 'https://www.epicgames.com/id/login?lang=en-US&noHostRedirect=true&redirectUrl=' + URL_CLAIM;
|
const URL_LOGIN = 'https://www.epicgames.com/id/login?lang=en-US&noHostRedirect=true&redirectUrl=' + URL_CLAIM;
|
||||||
const TIMEOUT = 20 * 1000; // 20s, default is 30s
|
const TIMEOUT = 20 * 1000; // 20s, default is 30s
|
||||||
const SCREEN_WIDTH = Number(process.env.SCREEN_WIDTH) - 80 || 1280;
|
const SCREEN_WIDTH = Number(process.env.SCREEN_WIDTH) - 50 || 1280;
|
||||||
const SCREEN_HEIGHT = Number(process.env.SCREEN_HEIGHT) || 1280;
|
const SCREEN_HEIGHT = Number(process.env.SCREEN_HEIGHT) || 1280;
|
||||||
|
|
||||||
// https://playwright.dev/docs/auth#multi-factor-authentication
|
// https://playwright.dev/docs/auth#multi-factor-authentication
|
||||||
|
|
@ -17,6 +17,7 @@ const context = await chromium.launchPersistentContext(path.resolve(__dirname, '
|
||||||
viewport: { width: SCREEN_WIDTH, height: SCREEN_HEIGHT },
|
viewport: { width: SCREEN_WIDTH, height: SCREEN_HEIGHT },
|
||||||
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36', // see replace of Headless in util.newStealthContext. TODO update if browser is updated!
|
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36', // see replace of Headless in util.newStealthContext. TODO update if browser is updated!
|
||||||
locale: "en-US", // ignore OS locale to be sure to have english text for locators
|
locale: "en-US", // ignore OS locale to be sure to have english text for locators
|
||||||
|
executablePath: "/usr/bin/chromium-browser",
|
||||||
args: [ // don't want to see bubble 'Restore pages? Chrome didn't shut down correctly.', but flags below don't work.
|
args: [ // don't want to see bubble 'Restore pages? Chrome didn't shut down correctly.', but flags below don't work.
|
||||||
'--disable-session-crashed-bubble',
|
'--disable-session-crashed-bubble',
|
||||||
'--restore-last-session',
|
'--restore-last-session',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue