-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from jackblk/main
feat: dockerize, fix sign in loop
- Loading branch information
Showing
7 changed files
with
959 additions
and
1,325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
userDataDir** | ||
node_modules | ||
screenshots | ||
|
||
.gitignore | ||
**Dockerfile** | ||
.dockerignore | ||
.env | ||
auth.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# FROM mcr.microsoft.com/playwright:v1.20.0 | ||
FROM ubuntu:focal | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# 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 | ||
|
||
# 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 | ||
apt-get install -y curl wget && \ | ||
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ | ||
apt-get install -y nodejs && \ | ||
# Feature-parity with node.js base images. | ||
apt-get install -y --no-install-recommends git openssh-client && \ | ||
npm install -g yarn && \ | ||
# clean apt cache | ||
rm -rf /var/lib/apt/lists/* && \ | ||
# 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 \ | ||
xvfb \ | ||
ca-certificates \ | ||
x11vnc \ | ||
curl \ | ||
tini \ | ||
novnc websockify \ | ||
&& apt-get clean \ | ||
&& rm -rf \ | ||
/tmp/* \ | ||
/usr/share/doc/* \ | ||
/var/cache/* \ | ||
/var/lib/apt/lists/* \ | ||
/var/tmp/* | ||
|
||
|
||
WORKDIR /fgc | ||
COPY package.json . | ||
# Install chromium & dependencies only | ||
RUN npm install \ | ||
&& npx playwright install --with-deps chromium \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . . | ||
|
||
# Shell scripts | ||
RUN mv ./docker/entrypoint.sh /usr/local/bin/entrypoint \ | ||
&& chmod +x /usr/local/bin/entrypoint \ | ||
&& mv ./docker/vnc-start.sh /usr/local/bin/vnc-start \ | ||
&& chmod +x /usr/local/bin/vnc-start | ||
|
||
|
||
ENTRYPOINT ["entrypoint"] | ||
CMD ["node", "epic-games.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
# 6000+SERVERNUM is the TCP port Xvfb is listening on: | ||
# SERVERNUM=$(echo "$DISPLAY" | sed 's/:\([0-9][0-9]*\).*/\1/') | ||
|
||
# Options passed directly to the Xvfb server: | ||
# -ac disables host-based access control mechanisms | ||
# −screen NUM WxHxD creates the screen and sets its width, height, and depth | ||
Xvfb "$DISPLAY" -ac -screen 0 "${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH}" >/dev/null 2>&1 & | ||
|
||
if [ "$VNC_ENABLED" = true ]; then | ||
vnc-start >/dev/null 2>&1 & | ||
fi | ||
|
||
exec tini -g -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
# Start VNC in a background process: | ||
x11vnc -display "$DISPLAY" -forever -shared -rfbport "${VNC_PORT:-5900}" \ | ||
-passwd "${VNC_PASSWORD:-secret}" -bg | ||
NOVNC_HOME=/usr/share/novnc | ||
ln -s $NOVNC_HOME/vnc_auto.html $NOVNC_HOME/index.html | ||
websockify -D --web "$NOVNC_HOME" "$NOVNC_PORT" "localhost:$VNC_PORT" & | ||
|
||
# Execute the given command: | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.